[Tutor] input string to own console stdin

Alan Gauld alan.gauld at yahoo.co.uk
Wed Nov 15 19:47:13 EST 2017

On 15/11/17 22:16, Eddio 0141 wrote:
> Hi.
> I've been searching on google about inputting to own stdin and press enter
> but so far i haven't found anything at all.

You need to give us a bit more context. This doesn't look like
standard library stuff so which package are you using? (Is that
what chatterbot is?)

Also without seeing the code that doesn't work we can only
make wild guesses about whats going wrong.

One thing to consider is that if (as I assume) you are trying
to talk to another process from Python you need to be sending
your data on stdout for it to be read on the other process'
stdin. You will also need to ensure that Pipes are switched
on in subprocess and that your execution environment is
piping your stdout to their stdin. eg you start chatterbot
with something like:

$ python myscript.py|chatterbot


$ chatterbot < python myscript.py

But show us your code, it will make life easier for all of us.

> i have tried this
> [
> https://stackoverflow.com/questions/8475290/how-do-i-write-to-a-python-subprocess-stdin
> ]
> but even it doesn't give me an syntax error, it did absolutely nothing.

See, even that question doesn't make sense, since you *read*
from stdin not write to it. It sounds like a fundamental
concepts kind of thing...

Alan G
Author of the Learn to Program web site
Follow my photo-blog on Flickr at:

More information about the Tutor mailing list