Re: [capi-sig] PyRun_InteractiveOne from string?

Thanks so much.. that looks like exactly what I want to do. Looks like you've done a fantastic job on the integration there - makes my weedy little console look very plain :)
Just need to work out why boost::python won't exec code.InteractiveConsole() now :)
Thanks again. Dave.
On Thu, Jun 10, 2010 at 9:29 PM, Campbell Barton <ideasman42@gmail.com>wrote:

I should have mentioned the console I linked to is not thread safe, I asked in #python about this and apparently there are 2 ways to work around this.
- use a context manager to work out which thread is taking to the overridden stdout.
- override print() not to use sys.stdout, since the consoles "write" function can already redirect exception output.
Id like to make this thread safe but for now its not a priority for me.
On Fri, Jun 11, 2010 at 10:16 PM, Dave Brotherstone <davegb@pobox.com> wrote:
--
- Campbell

Thanks for this. It's working perfectly now. Funnily enough threading was the next thing on the list, so the (non-console) scripts run in a separate thread, allowing them to be stopped by the UI. You don't happen to know if PyErr_SetString is thread safe, to "break" the currently running script?
I'll have to think about whether taking care of separate threads redirecting sys.stdout is important - I'm not sure that it is in our environment.
Cheers, Dave.
On Tue, Jun 15, 2010 at 11:53 AM, Campbell Barton <ideasman42@gmail.com>wrote:

I should have mentioned the console I linked to is not thread safe, I asked in #python about this and apparently there are 2 ways to work around this.
- use a context manager to work out which thread is taking to the overridden stdout.
- override print() not to use sys.stdout, since the consoles "write" function can already redirect exception output.
Id like to make this thread safe but for now its not a priority for me.
On Fri, Jun 11, 2010 at 10:16 PM, Dave Brotherstone <davegb@pobox.com> wrote:
--
- Campbell

Thanks for this. It's working perfectly now. Funnily enough threading was the next thing on the list, so the (non-console) scripts run in a separate thread, allowing them to be stopped by the UI. You don't happen to know if PyErr_SetString is thread safe, to "break" the currently running script?
I'll have to think about whether taking care of separate threads redirecting sys.stdout is important - I'm not sure that it is in our environment.
Cheers, Dave.
On Tue, Jun 15, 2010 at 11:53 AM, Campbell Barton <ideasman42@gmail.com>wrote:
participants (2)
-
Campbell Barton
-
Dave Brotherstone