-
Notifications
You must be signed in to change notification settings - Fork 986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python3 supported? #940
Comments
Not officially supported, ROS still uses 2.7. |
This is still a problem. From:
Python 2 EOL is fast approaching, and there are quite a few python modules/frameworks that really depend on Python 3 or at least significantly encourage them (through nice features only available in Python 3). We are currently writing a full web GCS which significantly leverages MAVROS, however we are having to move to Python 3 to follow support of other libraries/frameworks and the lack of Python 3 support in MAVROS is a dealbreaker. ROS 2 would be an option as it only supports Python 3, but MAVROS does not support ROS 2 either. |
Hello, Using futur, the support for python3 shouldn't be long as MAVROS don't have much pure python code. I will see to do it this weekend! |
@khancyr How do you deal with something like the error in this issue? Because in this case 'params' is from: |
Useful cheat sheet: http://python-future.org/compatible_idioms.html Option 2 for items() seems most suitable for this situation:
Option 1 is inefficient, Option 2 doesn't work because of the above |
Now getting:
Need to convert old cmp param to key: https://docs.python.org/3/library/functools.html#functools.cmp_to_key Importing these in mavros/param.py:
And then changing the sorted param in param_get_all() return to:
Fixes and works in both python2 and python3 - a little messy, maybe there's a cleaner method. |
Raised PR here with fix: |
Unfortunately i do not have any plans. In my current project i just use 3.6+... |
Simplify python3 fixes, mavlink#940
Simplify python3 fixes, mavlink#940 Remove unnecessary functools
Simplify python3 fixes, #940 Remove unnecessary functools
The PR is now merged, can this be closed? |
Yes, working great in python3 now. Thanks :) |
Issue details
param_get_all() function fails as python3 doesn't have iteritems. Possible solutions are to change to items() or import iteritems from future:
from future.utils import iteritems
MAVROS version and platform
Mavros: 0.22
ROS: Kinetic
Ubuntu: 16.04
Autopilot type and version
[ x ] ArduPilot
[ ] PX4
Version: 3.5
The text was updated successfully, but these errors were encountered: