cage schrieb: > Marc 'BlackJack' Rintsch schreef: >> In <[EMAIL PROTECTED]>, cage wrote: >> >>> can i write a eof to a file descriptor without closing it? >>> like: >>> fd.write(EOF) >>> or something >> >> What do you expect this to to? Writing a byte to the file and you don't >> know which value this byte has? >> >> Ciao, >> Marc 'BlackJack' Rintsch > > ok let me explain this a bit more... > I want to use a program that has a 'pipe' mode, in which you can use > stdin to send commands to the program. I found out that, when in pipe > mode and you are using the keyboard as input source you can do Ctrl-D to > 'signal' the program that you have finished typing your command. The > program parses and then performs the command, and it doesn't quit. It > quits after 'Quit\n' + Ctrl-D > Now I want a python script to provide the input, how do i do that? I now > use popen to be able to write to the program's stdin (p_stdin) > I noticed that when i do a p_stdin.close() it acts as a 'ctrl-d' in that > the program recognizes the signal to process the command, but then I > cannot use p_stdin anymore to do p_stdin.write(...)
According to wikipedia (german version, but I bet you can get that info using the english one, too) C-d sends EOT - end of transmission. Which is ascii 0x04. So I suggest you try writing "\x04" to the pipe. Maybe that works. Diez -- http://mail.python.org/mailman/listinfo/python-list