[Tutor] Pyserial and invalid handle

Cheeng Shu Chin cheengshuchin at gmail.com
Wed Dec 22 18:02:49 CET 2010


Hi all,
    Last few days ago,
I facing the same issue with my windows 7 64bit...
it work well with windows XP 32-bit...
FYI, I’m using python 2.6 amd64 bit as my core programming tools
currently, I’m start study/learn some arduino robotic and rewrite Python-Arduino API
I just do a quick anatomy to the Pyserial code and diff. of the (Ctypes) Handle range...
found both are diff range with same Kernel32 dll function call,
for 64-bit, ctypes.wintypes.HANDLE(-1) ==> c_void_p(18446744073709551615L)
in 32 bit, give c_void_p(4294967295L)
so what I guest it cause by Platform and environments issues. 
below is what I did and modifies on 64-bit server:
  a.. win32.py (C:\Python26\Lib\site-packages\serial) 
    a.. use HRESULT to replace HANDLE for kernel32 function handle return
  b.. serialwin32.py (C:\Python26\Lib\site-packages\serial) 
    a.. use win32file, pywintypes, win32event to rewrite readfile and writefile function
it seem work now for my 64-bit server, somehow I didn’t put some effort on self.timeout == 0 for serial.... as I don’t have enough time for it....
that I will leave it back to Pyserial Owner to take the honor for that....

hope this will help to all open source member... (that why I’m like python most)

Regards,
Cheeng Shu Chin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101223/732d1c86/attachment-0001.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: serialwin32.py
URL: <http://mail.python.org/pipermail/tutor/attachments/20101223/732d1c86/attachment-0002.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: win32.py
URL: <http://mail.python.org/pipermail/tutor/attachments/20101223/732d1c86/attachment-0003.ksh>


More information about the Tutor mailing list