Issue to import import x25crc in python

43 views
Skip to first unread message

Ulysse 314

unread,
Jul 23, 2021, 4:12:47 PM7/23/21
to mav...@googlegroups.com
Hello,

I generated mavlink in python with the following command:
python3 -m pymavlink.tools.mavgen --lang=Python --wire-protocol=2.0 --output=MavlinkGenerated/mavlink message_definitions/v1.0/common.xml

The issue is in my generated file, I have:
from ...generator.mavcrc import x25crc

I can't use the generated file unless I replace the line with:
from pymavlink.generator.mavcrc import x25crc

Is "...generator.mavcrc" an error? If so how can I fix it? If it is expected, how can I run my python script?

Thanks

Hamish Willee

unread,
Jul 27, 2021, 11:19:39 PM7/27/21
to MAVLink
There are several discussions on this around the place. Apparently it is not an error: https://github.com/ArduPilot/pymavlink/pull/152 - you just have to have the structure of your project right.

However there are several cases where it is clear that people have made the same change as you in order to allow them to use the library more conveniently.

Ulysse 314

unread,
Jul 28, 2021, 11:30:30 AM7/28/21
to mav...@googlegroups.com
Thanks for the answer.

Well, I've tried to put my generated file into:
pymavlink/MavlinkGenerated/mavlink.py
But when I run it, python tells me:
Traceback (most recent call last):
  File "mavlink.py", line 13, in <module>
    from ...generator.mavcrc import x25crc
ValueError: attempted relative import beyond top-level package

I'm not sure how I am supposed to do. Anyway it works for me with a little 'sed' command.

--
Sie erhalten diese Nachricht, weil Sie in Google Groups E-Mails von der Gruppe "MAVLink" abonniert haben.
Wenn Sie sich von dieser Gruppe abmelden und keine E-Mails mehr von dieser Gruppe erhalten möchten, senden Sie eine E-Mail an mavlink+u...@googlegroups.com.
Wenn Sie diese Diskussion im Web verfolgen möchten, rufen Sie https://groups.google.com/d/msgid/mavlink/d19bf20f-af27-4e4d-87a0-81cc572bc3d6n%40googlegroups.com auf.
Reply all
Reply to author
Forward
0 new messages