Opened 8 years ago

Closed 6 years ago

#2135 defect closed duplicate (duplicate)

twisted.intenet.stdio does not read console input on Windows

Reported by: synapsis Owned by:
Priority: lowest Milestone:
Component: core Keywords:
Cc: manlio_perillo@…, teratorn Branch:
Author: Launchpad Bug:

Description

I have tried to run the stdin and stdiodemo on Windows XP SP2 but what I type from my keyboard is not read.

I'm using Twisted 2.4, but I have tried also with the latest versions of _win32stdio and _pollingfile.

Moreover I do not see the cursor/caret.

Change History (6)

comment:1 Changed 8 years ago by synapsis

Here is the problem:

Traceback (most recent call last):

File "stdiodemo.py", line 74, in ?

reactor.run()

File "C:\Python2.4\lib\site-packages\twisted\internet\posixbase.py", line 218,

in run

self.mainLoop()

File "C:\Python2.4\lib\site-packages\twisted\internet\posixbase.py", line 226,

in mainLoop

self.runUntilCurrent()

--- <exception caught here> ---

File "C:\Python2.4\lib\site-packages\twisted\internet\base.py", line 555, in r

unUntilCurrent

call.func(*call.args, call.kw)

File "_pollingfile.py", line 72, in _pollEvent

workUnits += resource.checkWork()

File "_pollingfile.py", line 114, in checkWork

buffer, bytesToRead, result = win32pipe.PeekNamedPipe(self.pipe, 1)

pywintypes.error: (6, 'PeekNamedPipe', 'Handle non valido.')

Note: I have obtained this traceback by simply re raising the exception in checkWork.

'non valido' means 'not valid'

P.S.:
In the msdn documentation it not documented that values returned by GetStdHandle can be used with pipe functions.

Why not to use PeekConsoleInput?

comment:2 follow-up: Changed 8 years ago by glyph

  • Priority changed from normal to lowest
  • Summary changed from twisted.intenet.stdio does not read input on Windows to twisted.intenet.stdio does not read console input on Windows

I very nearly resolved this as invalid, but there is maybe a valid use-case here... Twisted programs can read and write stdio on UNIX are almost usable interactively, and the demos mentioned here imply that they are.

However, twisted.internet.stdio is not designed for console I/O on Windows, and for more advanced uses (twisted.conch.stdio, for example) it is infeasible that Windows could ever be made to work properly. So, this is much more of a feature request than a bug report.

If you want console I/O that works properly, consider switching operating systems. Windows is, and will always be, utter garbage in this respect.

comment:3 in reply to: ↑ 2 Changed 8 years ago by synapsis

Replying to glyph:

I very nearly resolved this as invalid, but there is maybe a valid use-case here... Twisted programs can read and write stdio on UNIX are almost usable interactively, and the demos mentioned here imply that they are.

However, twisted.internet.stdio is not designed for console I/O on Windows, and for more advanced uses (twisted.conch.stdio, for example) it is infeasible that Windows could ever be made to work properly. So, this is much more of a feature request than a bug report.

Yes.
See ticket #2157.

If you want console I/O that works properly, consider switching operating systems. Windows is, and will always be, utter garbage in this respect.

This is not the right answer.
It is possible to add async console I/O un Windows.

comment:4 Changed 8 years ago by teratorn

  • Cc teratorn added

comment:5 Changed 6 years ago by czzl

  • Resolution set to duplicate
  • Status changed from new to closed

Closed as duplicate of #2157.

comment:6 Changed 4 years ago by <automation>

  • Owner glyph deleted
Note: See TracTickets for help on using tickets.