Reputation: 63
I have been trying to find a solution through the web, but none of the solutions I saw solved my problem. It will be very grateful for anyone that can solved my problem.
I have install the pySerial-2.7 module into the python using the tutorial below: http://www.instructables.com/id/Interface-Python-and-Arduino-with-pySerial/
Everything went smoothly when I used Python 2.7 as I uninstall it and migrate to python 3.5
As I type this code:
import serial
It shown me this error:
Traceback (most recent call last):
File "<_pyshell#0>", line 1, in <_module> import serial File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/serial/init.py", line 21, in <_module>
from serial.serialposix import * File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/serial/serialposix.py", line 58
except IOError, e: ^
SyntaxError: invalid syntax
The python 3.5 cannot import serial which i do not know how to solve. Any help for this error will be much appreciated.
Upvotes: 0
Views: 1638
Reputation: 63
Try reinstall the pyserial using the Terminal in your MAC from extracting the tar file and running the installer again:
tar xfvz pyserial-2.7.tar.gz
cd pyserial-2.7
sudo python setup.py install
If everything going smoothly. Then I tried to install for Python 3:
sudo python3 setup.py install
A bit of searching revealed a bug ticket describing exactly this issue.
The solution is simple:
sudo rm -Rf build
sudo python3 setup.py install
When the next version of pyserial is released, this problem will be resolved. :-)
Upvotes: 1