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
Modifications to support Python 3 and wxPython Phoenix (4.0) - WIP #420
Conversation
21f7a04
to
6603349
Compare
You'd want to double-check that the pymavlink port to Python 3.x has been completed. I'm fairly certain it has though. All standard libraries other than that should be ok - we'd just have to check they all have Python 3.x packages. Finally, I suspect they'll be some syntax changes required in MAVProxy itself. But, WxPython is by far the largest item stopping us from Python 3 compatibility. Great work :) |
You'd also want to ensure that nothing's broken in the Windows build too |
Unfortunately I don't have access to a windows PC, so I'll have to outsource that particular item :) . However, I will have a go at installing the python 3 versions of everything and see where the remaining issues are. I'll report back here what I find... |
Ahh, OK. Outsourced to me in that case :) |
Just quickly tested console and map - they appear to work in Windows. Will do more comprehensive testing later. |
Good to hear and thanks for testing :) let me know if you hit any issues. What other GUI elements are currently in the main build / supported?
|
There's some common stuff like File Open/Save dialogs and menus in mp_menu.py and some of the other files in there. Also the graph UI, Horizon module, Checklist module. I have a sneaking suspicion that there'll be some Python2->3 syntax issues in some areas, so you'll be wanting to test all the modules for Python3 compatibility. We really need a unit test suite :( |
So heres an interesting problem I have found. Multiprocessing is not starting child processes during runtime. I can use a launch command like this |
MAVProxy/mavproxy.py
Outdated
if len(cmds) == 1 and cmds[0] == "": | ||
mpstate.empty_input_count += 1 | ||
for c in cmds: | ||
process_stdin(c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
calling module load map
here works, but the same command here https://github.com/SamuelDudley/MAVProxy/blob/357239cb97fd6b50d1fc8087b24502bfc75b67fa/MAVProxy/mavproxy.py#L771 fails silently.
It only seems to affect multiprocessing, child threads can run fine.
The only difference between the two locations of code is that this is in the main thread and the other location is in a thread derived from the main thread https://github.com/SamuelDudley/MAVProxy/blob/357239cb97fd6b50d1fc8087b24502bfc75b67fa/MAVProxy/mavproxy.py#L1138 .
@stephendade Thanks. Can you try the latest commit when you have a chance please. Windows does not support forkserver, so I have changed the multiprocessing type to spawn. I have MAVExplorer working but I have had to hack pymavlink DFReader.py as it is not compatible with python3. Modified DFReader.py is here https://gist.github.com/SamuelDudley/a016f6796f2fb448f183301e530ee4b9 (only tested binary logs at this stage) |
Ah thanks. I can fix the params and help. The settings screen is annoying but I can try a few things there. Not sure where to start with the map issue, but I'll have a poke around. |
Alright!
|
MAVProxy/modules/mavproxy_help.py
Outdated
@@ -22,31 +23,34 @@ def __init__(self, mpstate): | |||
try: | |||
import pkg_resources | |||
self.version = pkg_resources.require("mavproxy")[0].version | |||
except: | |||
# what error occurs here in windows? ImportError? | |||
except ImportError: # we need to catch the explicit error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What error will windows raise here? I'm guessing at ImportError...
Sorry about the help module... I fixed the param help because I thought thats what you were referring to! I have made some changes to the actual help module but I'm unsure what error windows will raise here. I need to catch the more specific error as the except statement was causing problems for me. I'm running from source and the two existing ways of determining the version of MAVProxy crashed the help module. Re the ImagePanel pickle... I'm stumped at this point... Any thoughts would be appreciated! :) |
That help module error should be fixed for you with the last set of commits. I think your on the right track with the pickling issue... I have spent a few hours attempting to get mission editor to run without success. At the moment I'm facing a range of cryptic pickling errors too :( Unfortunately the stack trace is completely useless... |
Thanks for testing... I'll have a look at it :) |
@stephendade Should be good now. |
@stephendade Great! Thanks again for testing... I'll have a look at that issue |
I am hugely in favor of this PR for one main reason. Mac GUI support is possible with Python 3. I have a demo running on my machine. |
@stephendade tab completion is working on my linux machine... I'll have to chase down the issue based on your stack trace. Please bear with me... |
Im rebasing here https://github.com/SamuelDudley/MAVProxy/tree/wx_phoenix_wip_rebase |
9d0a53e
to
126daa8
Compare
@amilcarlucas rebased |
import traceback | ||
import select | ||
import shlex | ||
import platform | ||
import importlib |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will work for python2.7+ and python3.x
I remember that I try to use with Python 3.6 version but without success. |
python2 support should be discarded, it almost reaches end-of-life. |
In reality python2 will not go away overnight. I wish I had more time to take some of my changes in this branch and make usable patches to help the maintainers... |
On Sun, 25 Feb 2018, Samuel Dudley wrote:
In reality python2 will not go away overnight. I wish I had more time to
take some of my changes in this branch and make usable patches to help the
maintainers...
If anyone feels up to it it would help out the project quite a bit re
python3 support!
People have suggested Qt instead of Phoenix.
Has anybody done an in-depth look at these options?
|
As an aside, wxPython 4 now appears to support Python 2.7 (https://pypi.python.org/pypi/wxPython/4.0.1), so no issue with GUI toolkits. I'd really like to resurrect this PR and get it merged in - thoughts? |
@stephendade I would love to see python 3.x support merged in but I personally don't have a much time to commit to this PR at the moment, sorry. |
If you look at https://github.com/ArduPilot/MAVProxy/pull/420/files you can see that the number of changes is not that huge but it needs to be broken down into a set of PRs rather than this mess |
That's fine. Once I've finished my work with the cuav software, I'll see if I can split this up into manageable PR's and add some unit tests/CI to make the review easier. |
i've got a new py3 PR here #560 |
@tridge are you happy for me to close this PR? |
I have opened this WIP to get an idea for what would be required to support wxPython Phoenix and python 3.x. This WIP is a quick hack and contains breaking changes for 2.x Python versions. Tested with Python 3.5 and 4.0.0a3 release of wxPython Phoenix.