Have you considered redirecting input from the terminal session itself?

On Linux, I think you can test against sys.stdin.isatty() and assign a
variable to /dev/tty.

The methodology is similar on Windows but you need to import msvcrt and
grab msvcrt.getche().


Thank you,
Andrew Robert
Systems Architect
Information Technology - OpenVMS
Massachusetts Financial Services
Phone:  617-954-5882
Pager:   781-764-7321
E-mail:  [EMAIL PROTECTED]
Linux User Number: #201204

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Vincent Nijs
Sent: Tuesday, December 07, 2004 2:38 PM
To: [EMAIL PROTECTED]
Subject: Re: [Tutor] Connecting to interactive program

Has anyone ever tried to send commands to a running interactive python
session from, say, the command line or another app?

If so, please let me know how you achieved this.

Vincent


On 12/1/04 4:10 PM, "Vincent Nijs" <[EMAIL PROTECTED]>
wrote:

> Hi,
> 
> I am trying to send information from an editor (vim) to an interative
> program (say the Python commandline, R, Matlab, etc.).
> 
> I have tried to connect a named pipe to the interactive program using
> mkfifo. For some reason this doesn't work properly however (<eof>
seems to
> be the first thing sent).
> 
> Could anyone provide a very very simple example where from a terminal
> command line I could send, say, 'x=3' to an open interactive python
session?
> I'd like to have something that works on WinXP and Mac (or Linux).
> 
> Thanks!
> 
> Vincent

-- 



_______________________________________________
Tutor maillist  -  [EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/tutor


"MFS Relay Service" made the following
 annotations on 12/07/2004 03:00:42 PM
------------------------------------------------------------------------------
This email communication and any attachments may contain proprietary, 
confidential, or privileged information.  If you are not the intended 
recipient, you are hereby notified that you have received this email in error 
and that any review, disclosure, dissemination, distribution or copying of it 
or its contents is prohibited.  The sender does not waive confidentiality or 
any privilege by mistransmission.  If you have received this email in error, 
please notify the sender immediately, delete this email, and destroy all copies 
and any attachments.
==============================================================================

_______________________________________________
Tutor maillist  -  [EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to