Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > embedding Python and changing stdin, stdout and stderr

Reply
Thread Tools

embedding Python and changing stdin, stdout and stderr

 
 
Vincent Touquet
Guest
Posts: n/a
 
      09-02-2004
Hi,

In a project where I have embedded Python in a C++ application, I have
the need to replace what Python considers to be stdin, stdout and/or
stderr.

In sysmodule.c in the Python sources, I find the following lines of
code:

sysin = PyFile_FromFile(stdin, "<stdin>", "r", NULL);
....
PyDict_SetItemString(sysdict, "stdin", sysin);

Where stdin is the C constant FILE pointer and sysin is a PyObject
pointer.

Would it be feasible for me to provide my own PyFile to replace sysin
in sysdict ? It would seem to me that it would be sufficient to
provide the Python interpreter with a different standard in/out/err
than the one provide by the OS (through C).

best regards,

Vincent
 
Reply With Quote
 
 
 
 
Adrian B.
Guest
Posts: n/a
 
      09-03-2004
http://www.velocityreviews.com/forums/(E-Mail Removed) (Vincent Touquet) wrote in message news:<(E-Mail Removed). com>...
> Hi,
>
> In a project where I have embedded Python in a C++ application, I have
> the need to replace what Python considers to be stdin, stdout and/or
> stderr.
>


Checkout this thread:
http://mail.python.org/pipermail/c++...er/008014.html
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing the (codec) error handler for the stdout/stderr streams in Python 3.0 Jukka Aho Python 3 09-02-2008 10:53 PM
stdout and stderr don't occur sequentially in Eclipse and Netbeans ZelluX Java 15 06-25-2008 12:06 AM
stdout/stderr for only one thread in a multithreaded python app notanotheridiot Python 1 07-14-2006 10:17 AM
Re: embedding Python and changing stdin, stdout and stderr Vincent Touquet Python 0 09-06-2004 04:35 PM
Redirecting Python stdout ,stderr and stdin Jan Knop Python 4 11-24-2003 10:14 AM



Advertisments