Home        Store        Learn        Blog

Pymavlink import not working

Hi all,

I installed pymavlink on my computer so that I could use it for the mavlogdump.py file. I used both “sudo pip install pymavlink” and “pip install pymavlink --user” commands to install the program. With both methods I opened python and did “import pymavlink”. I then tried, as the ardusub instructions suggest, to test the import with “pymavlink._doc_” and received the following message: AttributeError: ‘module’ object has no attribute ‘_doc_’ . I assume this means that pymavlink was not properly imported. So what went wrong? Is pymavlink not installed properly or am I not importing it properly?

Thank you!


Are you using single underscores ? It should be a double underscore.
The documentation points to test with this simple input/code.

import pymavlink

Note that around doc there is a double underscore around it.

Ah, the infamous double underscore! That solved it thank you.

Also, if I am running mavlogdump.py on a file, how do I set the location that file is being read from?

Right now my only command is “mavlogdump.py test.bin”, the test.bin file is in my QGroundControl folder and the mavlogdump.py script is in my mac library.

I am working in bash in terminal.



You can use the -f argument to select the input file.

-f, --follow          keep waiting for more data at end of file

And >> to redirect the script output to a file, E.g:

mavlogdump.py -f /path/my_awesome_log.tlog --format=csv --types AHRS3,RAW_IMU >> putput_file.txt

If you need any help with any functionality, take a look in --help parameter.

mavlogdump.py --help

That worked, perfect! Thank you.

I looked in --help. And was able to read a file. However, I want to output pressure and temperature data. I have the celsius and standard barometer sensors hooked up. What “types” would they be? I cannot find a list of acceptable types anywhere.

The acceptable types will be different depending on if you are using a tlog or binary log.

You can open the log with mavlogexploer.py and use tab completion to see the available types in a log.

See also the logging documentation: https://www.ardusub.com/operators-manual/logging.html