How to abort a long running command in wx.py.PyShell ?

How to abort a long running command in wx.py.PyShell ? like pressing Ctrl+c
in console.

···

--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/How-to-abort-a-long-running-command-in-wx-py-PyShell-tp5723427.html
Sent from the wxPython-users mailing list archive at Nabble.com.

linuxNewBee wrote:

How to abort a long running command in wx.py.PyShell ? like pressing Ctrl+c
in console.

Do you mean, as a human being? Ctrl-C should work in PyShell just like
it does in the console.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Yes I expected the same. Pressing ctrl +c should abort the running command.

···

Sent from Sony mobile

On Feb 2, 2015 1:44 PM, “Tim Roberts” timr@probo.com wrote:

linuxNewBee wrote:

How to abort a long running command in wx.py.PyShell ? like pressing Ctrl+c

in console.

Do you mean, as a human being? Ctrl-C should work in PyShell just like

it does in the console.

Tim Roberts, timr@probo.com

Providenza & Boekelheide, Inc.

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Tim Roberts wrote:

linuxNewBee wrote:

How to abort a long running command in wx.py.PyShell ? like pressing Ctrl+c
in console.

Do you mean, as a human being? Ctrl-C should work in PyShell just like
it does in the console.

Unfortunately PyShell doesn't have KeyboardInterrupt support. Since the Python shell is running in the same process it is the GUI that receives the key events, so they are not turned into a SIGINT by the system. Also since they are running in the same process without threading, PyShell doesn't get the event until after the long running python code completes.

There are a couple ways to work around this that come to mind, but so far nobody has attempted it as far as I know. I will gladly review and apply patches that implement this if anyone wants to give it a try.

···

--
Robin Dunn
Software Craftsman

Hello,

what are work around ?

Actually I have built an application over PyShell and it would be very costly for me look for me to look for other alternatives…

Thanks and Regards

Hemadri

···

On Sat, Mar 14, 2015 at 3:04 AM, Robin Dunn robin@alldunn.com wrote:

linuxNewBee wrote:

How to abort a long running command in wx.py.PyShell ? like pressing Ctrl+c

in console.

Do you mean, as a human being? Ctrl-C should work in PyShell just like

it does in the console.

Tim Roberts wrote:

Unfortunately PyShell doesn’t have KeyboardInterrupt support. Since the Python shell is running in the same process it is the GUI that receives the key events, so they are not turned into a SIGINT by the system. Also since they are running in the same process without threading, PyShell doesn’t get the event until after the long running python code completes.

There are a couple ways to work around this that come to mind, but so far nobody has attempted it as far as I know. I will gladly review and apply patches that implement this if anyone wants to give it a try.

Robin Dunn

Software Craftsman

http://wxPython.org

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Thanks and Regards
Hemadri Saxena
9086087510

Hemadri Saxena wrote:

Hello,

what are work around ?

Actually I have built an application over PyShell and it would be very
costly for me look for me to look for other alternatives...

Probably the best fix would be to run the code executed in the PyShell in another Python process, using a small local server in the process to communicate the code snippets to be executed, send back the stdout, stderr, exceptions, etc. for display in PyShell. Then long running code snippets do not block the PyShell GUI and supporting things like interrupting the execution of the code can be just another message that gets sent over to the other process and handled there.

···

--
Robin Dunn
Software Craftsman

I have tried that as follows…facing issue…Do u have any suggestion

  1. Create a new Python Process…

  2. started thread which take output steam and read the ouput and put it in a queue

  3. other thread which read the queue and update the GUI. using wx.CallAfter()

but the issue when that process generates lots of output…that is is too many call to wx.CallAfter() the GUI goes in responsive…

···

On Tue, Mar 17, 2015 at 7:05 PM, Robin Dunn robin@alldunn.com wrote:

Hello,

what are work around ?

Actually I have built an application over PyShell and it would be very

costly for me look for me to look for other alternatives…

Hemadri Saxena wrote:

Probably the best fix would be to run the code executed in the PyShell in another Python process, using a small local server in the process to communicate the code snippets to be executed, send back the stdout, stderr, exceptions, etc. for display in PyShell. Then long running code snippets do not block the PyShell GUI and supporting things like interrupting the execution of the code can be just another message that gets sent over to the other process and handled there.

Robin Dunn

Software Craftsman

http://wxPython.org

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Thanks and Regards
Hemadri Saxena
9086087510