Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #8822
| From | Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | embedding: how do I redirect print output? |
| Followup-To | comp.lang.python |
| Date | 2011-07-05 14:50 +0200 |
| Message-ID | <kkdbe8-eum.ln1@satorlaser.homedns.org> (permalink) |
Followups directed to: comp.lang.python
Hi! I'm trying to add some scripting capabilities to an application. Since it is a GUI application, I need some way to display output from Python. For 3.x, where "print" is a function, I'd just exchange this function with one that redirects the output to a log window, right. However, I'm using 2.6 here, where that can't work. So, what I was thinking was to redirect "sys.stdout" and "sys.stderr" to a log window and possibly replace "sys.stdin" with something that causes meaningful errors if some code tries to use it, but that last point is just icing on the cake. What seems cumbersome is that I'll need to write something that supports the file interface using C, which is still a bit awkward. I'm wondering, isn't there an easier way to achieve this? How would you do it? Thank you! Uli -- Domino Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
embedding: how do I redirect print output? Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2011-07-05 14:50 +0200
Re: embedding: how do I redirect print output? Thomas Jollans <t@jollybox.de> - 2011-07-05 16:18 +0200
Re: embedding: how do I redirect print output? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-06 00:36 +1000
Re: embedding: how do I redirect print output? Chris Angelico <rosuav@gmail.com> - 2011-07-06 01:20 +1000
Re: embedding: how do I redirect print output? Andrew Berg <bahamutzero8825@gmail.com> - 2011-07-05 16:04 -0500
Re: embedding: how do I redirect print output? Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2011-07-06 08:24 +0200
csiph-web