pyserial doesn't recognize virtual serial port

salrandazzo salvatore.randazzo at gmail.com
Wed Nov 21 02:45:39 EST 2007


Try reading the sourceforge.net help forum about com0com:
http://sourceforge.net/forum/forum.php?thread_id=1395157&forum_id=440109
Maybe you can find the solution.
I think you should prefix the port name with "\\.\"
Something like "\\.\CNCA0"

Did you ever try to use the com2tcp utility?
I'm trying to use it, but there are so little information.
I posted a request on the forum, and still waiting for answer.
Salvatore



On 12 Ott, 06:50, naveen.sabapa... at gmail.com wrote:
> Hi,
>   I am trying to use virtual serial ports to develop/test my serial
> communication program. Running in to trouble...
>
>   I am using com0com to create the virtual ports. The virtual ports
> seem to be working fine when I test it with Hyperterminal .
>
> I am using the example program that comes with pyserial, as below.
> ---------------
> import serial
> ser = serial.Serial('CNCA0') #open virtual serial port
> print ser.portstr            #check which port was realy used
> ser.write("Hello")              #write a string
> ser.close()                  #close port
> -----------------
>
> The following is the error message:
>
> --------------
> Traceback (most recent call last):
>   File "C:\Python25\Naveen Files\TestSerial", line 2, in <module>
>     ser = serial.Serial('CNCA0') #open first serial port
>   File "c:\Python25\Lib\site-packages\serial\serialutil.py", line 156,
> in __init__
>     self.open()
>   File "c:\Python25\Lib\site-packages\serial\serialwin32.py", line 55,
> in open
>     raise SerialException("could not open port: %s" % msg)
> SerialException: could not open port: (2, 'CreateFile', 'The system
> cannot find the file specified.')
> --------------
>
> When I try with 'COM3', which comes inbuilt in my laptop, COM3 is
> recognized. Few other posts on the web seem to indicate pyserial
> should work fine with virtual serial ports. What am I missing? Please
> help.
>
> --Thanks
> --NS




More information about the Python-list mailing list