Serial port gotcha with win32all
Mark Hammond
MarkH at ActiveState.com
Sat Oct 20 06:01:13 EDT 2001
Markus Demleitner wrote:
> Hi,
>
> I'm getting increasingly desperate. All I'm trying to do is
> attach a little serial gizmo that runs just fine when talked
> to from a linux box (using some homegrown python software) to
> a machine plagued by Windows 2000.
>
> Realizing that termios doesn't buy me much in win32, I soon
> ran across uspp which basically acts as a wrapper around the
> win32all or termios modules on the respective platforms.
>
> Under linux, uspp worked quite as well as my own termios-based
> code (perhaps not too surprisingly). Under win32, however,
> write()s seem to work but read()s consistently fail with a
> "incorrect paramater" exception in a call to win32file.ReadFile.
>
> Now, clearly the OpenFile succeded, and the handle didn't change
> between the open and the read, the error is not in the number
> of bytes to read (passing some weird object there causes a
> ParameterError, as expected), and in general I've not been
> able to gain any clue as to what is going on. The win32all
> sources seem somewhat intimidating, at least for me with
> no knowledge of the win32 API whatsoever.
>
> So -- can anyone give me a hint where to start getting a
> grip on this one?
Look at the
win32comport_demo.py sample - it seems to work just fine. Failing that, post the smallest possible code snippet you can come up with that demonstrates the problem.
Mark.
More information about the Python-list
mailing list