John, On 28 November 2010 15:55, John Smith <jocj...@verizon.net> wrote:
> Python 2.7 (r27:82525, Jul 4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)] > on win32 > Type "copyright", "credits" or "license()" for more information. > > >>> import serial > >>> ser = serial.Serial('com1', timeout = 5) > >>> x = ser.read() > > Traceback (most recent call last): > File "<pyshell#2>", line 1, in <module> > x = ser.read() > File "E:\Python27\lib\site-packages\serial\serialwin32.py", line 236, in > read > raise SerialException("ReadFile failed (%s)" % ctypes.WinError()) > SerialException: ReadFile failed ([Error 6] The handle is invalid.) > >>> > Ugh, you're probably not going to like this. I've done some googling and it appears this may be a 64-bit issue with the "ctypes" module... apparently "64-bit ctypes can only import 64-bit libraries". See here: http://ur.ly/vSMQ Then again, it also seems to be an open issue on the PySerial bug tracker: http://ur.ly/vZNL Note, the above ticket suggests that PySerial 2.4 works ok (impliedly even on 64-bit XP, so I imagine also on Windows 7.) You should be able to try this out by downloading the 2.4 version instead and installing it in the same way you did the 2.5 version. In any case, it might be an idea to post a report/add a comment to that bug report as well to maybe help get this issue resolved. Cheers, Walter
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor