-
Notifications
You must be signed in to change notification settings - Fork 26
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
Python 3 code does not execute. #23
Comments
Please use the command " pip install megapi --upgrade" to update your megapi package. |
sudo pip uninstall megapi // To uninstall 0.1.9 pip install megapi --upgrade pi@raspberrypi:~ $ pip install megapi --upgrade pi@raspberrypi:~ $ python3 BigBot_New.py |
Version 0.2.2 is not getting to Python3.5! pi@raspberrypi:/usr/local/lib/python3.5/dist-packages $ ls pi@raspberrypi:/usr/local/lib/python3.5/dist-packages $ more megapi.py class mSerial(): |
pi@raspberrypi:~ $ python3.7 BigBot_New.py |
Please check your environment. The contents of megapi.py are: import sys if sys.version > '3': |
The way to solve this problem(No module named 'serial') is : pip install pyserial |
Python2, Python3 and Python3.7 each have their own folder-(python2.7), (python3.5) and (python3.7) respectively. Python(2) in folder (python2.7) functions correctly and thus must be populated correctly. It also seems to conform to what I would expect with respect to PythonForMegaPi. The (python3.5) and (python3.7) folders do not seem to be populated with the correct PythonForMegaPi code. The (python3.5) folder refers to megapi 0.1.9 which is how it is getting to 'print self'. The (python3.7) folder does not even have a dist-packages folder. The following are notes on what I have done and the responses that I got. pi@raspberrypi:/usr/local/lib $ ls pi@raspberrypi:/usr/local/lib/python2.7/dist-packages $ ls pi@raspberrypi:/usr/local/lib/python3.5/dist-packages $ ls pi@raspberrypi:/usr/local/lib/python3.7 $ ls 1920 pip pi@raspberrypi:~ $ pip install pyserial pi@raspberrypi:~ $ python BigBot_New.py pi@raspberrypi:~ $ python3 BigBot_New.py pi@raspberrypi:~ $ python3.7 BigBot_New.py |
Your environment looks pretty messy. Maybe you'll have to reinstall Python2 or Python3. |
Python 3 checks the new PythonForMegaPi library for consistency with Python 3. The old code for Python 2 does not pass the test.
pi@raspberrypi:~ $ python3 MyRobot.py
Traceback (most recent call last):
File "MyRobot.py", line 2, in
from megapi import *
File "/usr/local/lib/python3.5/dist-packages/megapi.py", line 12
print self
^
SyntaxError: Missing parentheses in call to 'print'
The text was updated successfully, but these errors were encountered: