Hello John<br><br><br><br><div class="gmail_quote">On 29 November 2010 21:44, John Smith <span dir="ltr"><<a href="mailto:jocjo.s@verizon.net" target="_blank">jocjo.s@verizon.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi, Walter -<br>
<br>
Thanks for all the research. This was my second attempt at installing the 2.4 version. I did it thus:<br>
<br>
E:\Python27\pyserial-2.4>..\python setup.py install<br>
standart distutils<br>
running install<br>
running build<br>
running build_py<br>
creating build<br>
creating build\lib<br>
creating build\lib\serial<br>
copying serial\serialcli.py -> build\lib\serial<br>
copying serial\serialjava.py -> build\lib\serial<br>
copying serial\serialposix.py -> build\lib\serial<br>
copying serial\serialutil.py -> build\lib\serial<br>
copying serial\serialwin32.py -> build\lib\serial<br>
copying serial\sermsdos.py -> build\lib\serial<br>
copying serial\__init__.py -> build\lib\serial<br>
running install_lib<br>
running install_egg_info<br>
Removing E:\Python27\Lib\site-packages\pyserial-2.4-py2.7.egg-info<br>
Writing E:\Python27\Lib\site-packages\pyserial-2.4-py2.7.egg-info<br>
<br>
E:\Python27\pyserial-2.4><br>
<br>
<br>
But, when I tried it in Python, I got the same as before:<br>
<br>
<br>
>>> import serial<br>
>>> ser = serial.Serial(0, timeout = 1)<br>
>>> ser<br>
Serial<id=0x225c240, open=True>(port='COM1', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)<div><br>
>>> ser.read()<br>
<br>
Traceback (most recent call last):<br></div>
File "<pyshell#3>", line 1, in <module><div><br>
ser.read()<br>
File "E:\Python27\lib\site-packages\serial\serialwin32.py", line 236, in read<br>
raise SerialException("ReadFile failed (%s)" % ctypes.WinError())<br>
SerialException: ReadFile failed ([Error 6] The handle is invalid.)<br>
>>><br><br></div></blockquote><div><br>I've checked and I think it was a mistake to suggest installing pyserial
2.4 on top of 2.5 without first removing 2.5 explicitly. It appears that doing so actually still retains
the previous version of serialwin32.py in use, based on the fact that I've
manually had a look at serialwin32.py from both pyserial2.4 and
pyserial2.5 and that fact that line 236 in pyserial2.5 is where the
error is raised, and pySerial2.4 by contrast has "if err: #will be
ERROR_IO_PENDING:" on line 236. Consequently this implies that you're still using pyserial2.5 above. (Aside: I originally tested my suggestion for installing pyserial2.4 and tested it by importing the module (e.g. "import serial") and
then did a "help(serial)" which gave me the impression of it having done the
right thing and using pyserial2.4, but apparently that's not definitve, or I made a mistake somewhere along the line and got the wrong end of the stick.)<br><br>So. My apologies, but I think that suggestion has added to the confusion. <br>
<br>In any case, to fix it let's delete all instances of pySerial and then install it again, as follows:<br><br>1.) Open up your Python "site-packages" folder in Windows Explorer, e.g. open up:<br>E:\Python27\lib\site-packages<br>
<br>2.) Delete any folder named "serial" that you may see.<br><br>3.)
Delete any *file* name pyserial*.* that you may see, probably you'll
see "pyserial-2.4-py2.7.egg", there may also be an info file.<br><br>4.)
Open up a Python shell and confirm that you can't import pyserial
anymore (e.g. "import serial" fails with e.g. "ImportError: No module
named serial". If it still imports then you still have some vestiges of
the existing pyserial installation left over. <br><br>5.) After confirming the previous versions are gone, please try reinstalling it again from scratch. (E.g. extract source to some suitable place and run "python setup.py install" from there, which copies the required files into site-packages etc.)<br>
<br>6.) After installing, confirm "import serial" works again, then try your test again.<br><br>Apologies again for adding to the confusion, and hopefully we're getting closer. :-(<br><br>Walter<br><br> </div>
</div>