pyserial port connection problem
nick at craig-wood.com
Fri Nov 17 17:30:04 CET 2006
Jon <jspeis at gmail.com> wrote:
> I wrote some code to read in info from a port using pyserial. the code
> reads info sent by a box that is connected to my computer by an
> rs232-to usb adapter. When I was writing the code and testing it on my
> computer it worked fine.
> I ran py2exe on the program (which uses wxpython for its gui) and sent
> the output from the py2exe to another computer. now when I try to run
> it on this other computer it fails to open the port. it gives the error
> that it cannot createfile. the code I'm using to connect is the same as
> it is when it worked on my computer.
> I do notice that pyserial sees this port on the other computer as
> \\\\.\\COM14 - while windows device manager displays it as COM14.
That is a bit too many backslashes... You can only directly open COM1
to COM9 under windows. If you have >= 10 COM ports you need to use
the \\.\COM14 syntax. It looks like your backslashes have been
doubled somewhere along the line, though this maybe be a printing
Are you passing the port name into pyserial or allowing the user to
choose it, or just getting pyserial to choose the n-th port?
Also are you running as adminstrator? You may need admin rights to
open a serial port under windows (I'm not sure).
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick
More information about the Python-list