Dear colleagues,

Having an issue with the PySerial implementation under Jython. I've installed the package and also added the javax.comm .jar libraries

Runing the pure Java display via javax.comm package, I get a list of available COMx ports, See below:
C:\jython\myprojects\PySerial>java -cp C:\jython\myprojects\PySerial\javaxcomm\comm.jar;. ListPorts
COM3: Serial
COM8: Serial
LPT1: Parallel
LPT2: Parallel

When using through the Jython implementation under Windows XP, the serial interface is not opening, throwing an error:

Serial<id=0x1, open=False>(port='COM8', baudrate=9600, bytesize=8, parity='N', s
topbits=1, timeout=None, xonxoff=False, rtscts=False, dsrdtr=False)
Error opening serial port COM8

Here the source code with the problem:
# read serial interface with Jython
# use PySerial, requires javax.comm
import sys
from org.python.util import PythonObjectInputStream
from org.python.core import *
from import *
from import *
from java.lang import *
sysProp = System.getProperties()
userdir = sysProp.getProperty("user.dir")
userdir = userdir.replace("\\", "/")  
sys.path.append(userdir + "/javaxcomm/comm.jar")
# PySerial package was installed with jython install
# path is "C:/jython/jython2.5.1/Lib/site-packages/serial"
import serial
from javax.comm import *
port = "COM8"
baud = 9600
ser = serial.Serial()
ser.port = port
ser.baudrate = baud
print str(ser)
try:    # <=== the error is here  
    sys.stderr.write("Error opening serial port %s\n" % (ser.portstr) )

Running it under Python 2.6 its also OK. Any idea how to fix this issue is welcome.



Claude Falbriard
Certified IT Specialist L2 - Middleware
AMS Hortolāndia / SP - Brazil
phone:    +55 13 9760 0453
cell:         +55 13 8117 3316