Standard shell environment

As much as possible within the wxPython environment, PyCrust behaves the same as the command line Python shell. This includes some unusual situations, such as pickling instances of classes that are defined within a shell session. One area where PyCrust falls short in its ability to duplicate the command line functionality is keyboard interrupts. Once Python code has been entered into the PyCrust shell, there is no way to interrupt the execution of the code. For example, suppose you coded an infinite loop in PyCrust, as in the following:

After you press Enter, and the code is sent to the Python interpreter, PyCrust stops responding. To interrupt the infinite loop, shut down the PyCrust program. This shortcoming of PyCrust is in contrast to the command line Python shell, that retains the ability to handle a keyboard interrupt (Ctrl + C). From the command line Python shell, you would see the following behavior:

Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello

Traceback (most recent call last): File "<stdin>", line 2, in ?

Keyboardlnterrupt

The nature of event handling in a GUI environment has made it extremely difficult to devise a solution that allows PyCrust to break out of an infinite loop, or interrupt any long-running sequence of code entered at the shell prompt. A future version of PyCrust may provide a solution to this. In the meantime, keep this behavior in mind. Fortunately, this is the only known difference between PyCrust and the standard command shell. In all other regards, the PyCrust shell works exactly the same as the command line Python shell.

Was this article helpful?

0 0

Post a comment