Added instructions for patching pyserial for python3

master
Dave Hylands 2015-06-13 08:46:23 -07:00
rodzic 889ff15ccd
commit bccaba4fa5
1 zmienionych plików z 32 dodań i 1 usunięć

@ -54,4 +54,35 @@ To exit from 'screen' type 'Ctl-a, k'; and then answer 'y' to exit
Development workflow on mac is the same as for Linux; see [DevelWorkflow](DevelWorkflow) for recommended workflow practices and usage of git.
TODO: Issues that may be encountered using previous versions of pyboard firmware (USB mass storage issue) that can be fixed with firmware upgrade
TODO: Issues that may be encountered using previous versions of pyboard firmware (USB mass storage issue) that can be fixed with firmware upgrade
# Patching pyserial 2.7
It turns out that there are some bugs in the OSX portion of pyserial 2.7. To confirm if your pyserial has been fixed or not, plug in your pyboard, and the run the following python script using python3 (just to be clear, this script will be run on your Mac, not on the pyboard)
```python
from serial.tools import list_ports
for port in list_ports.comports():
print(port)
```
If you get output like this:
```
['/dev/cu.Bluetooth-Incoming-Port', 'n/a', 'n/a']
['/dev/cu.Bluetooth-Modem', 'n/a', 'n/a']
['/dev/cu.usbmodem622', 'Pyboard Virtual Comm Port in FS Mode', 'USB VID:PID=f055:9800 SNR=000000000011']
```
Then your version of pyserial is working and you don't need to do anything further.
If, however, you get no output (no serial ports listed) when running python3 and get output similar to the above when running python2 then you have the buggy version.
I found this issue http://sourceforge.net/p/pyserial/patches/38/ with an attached patch which addresses the issue.
I installed python34 using ports (as in the first part of this wiki page) and my python 3.4 version of pyserial was found here: `/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/serial`
I executed the following commands to install the patched version:
```
cd /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/serial/tools
sudo cp list_ports_os.py list_ports_osx_original.py
sudo curl -O http://sourceforge.net/p/pyserial/patches/_discuss/thread/603bd426/55a8/attachment/list_ports_osx.py
```
```
Now I was able to execute the list_ports.comports() example posted above under python3 and it produced the correct output.