cmd.Cmd bug or at least docu-bug

D

Diez B. Roggisch

Hi,

I'm fiddling around with module cmd. I tried to pass my own streams as
replacements for stdin and stdout. However, stdin wasn't working. After a
look into the sourcecode I discovered that there is an class-variable
called

use_rawinput

that prevents using the passed stdin. I then read the docs again - and found
it described. However, I think it should be mentioned on the first page
where the constructor is described that without setting use_rawinput to
False, stdin will be ignored.

Or even better either make use_rawinput set to false in case stdin is passed
anything but None or at least make it a keyword argument.

Any thoughts about this?

Diez
 
M

Michele Simionato

Hi,

I'm fiddling around with module cmd. I tried to pass my own streams as
replacements for stdin and stdout. However, stdin wasn't working. After a
look into the sourcecode I discovered that there is an class-variable
called

use_rawinput

that prevents using the passed stdin. I then read the docs again - and found
it described. However, I think it should be mentioned on the first page
where the constructor is described that without setting use_rawinput to
False, stdin will be ignored.

Or even better either make use_rawinput set to false in case stdin is passed
anything but None or at least make it a keyword argument.

Any thoughts about this?

Diez

I run into the same issue and I solved it by using a custom subclass
of Cmd, but I agree
that the cmd module could be improved. I even wrote a cmd2 module that
I should publish
one day or another. +1 to submit a bug report.

Michele Simionato
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top