Infinite loops and remote interpreter

247 views
Skip to first unread message

Rodolfo

unread,
Jun 30, 2007, 7:51:39 PM6/30/07
to PyScripter
I am new to PyScripter, and I'm so amazed at how it makes my Python
experience better.
Earlier today I got the official 1.7.2 release, and sometime ago
upgraded to v1.8.7.1.

BTW I have three suggestions:

1) It would be useful to be able to choose between normal raw_input
and input and the dialog that pops up on PyScripter. Not the the
dialog isn't good, but just that sometimes I need to move the focus
out of the dialog, which seems impossible.

2) I would like to press Ctrl+C to raise a KeyboardInterrupt.... it's
specially useful when running an infinite loop for some reason, or to
force a program termination. Running a simple code as below freezes
PyScripter:

>>> while 1:
... print 'Hello world',


3) I tried selecting a interpreter other than "Internal" before I
installed, intentionally before I got RPyC installed, and it throws
out some errors. The only way out is Ctrl+Alt+Del and Terminate
Process...
Maybe there should be a nice error message?

Well, those are just suggestions.... PyScripter is great!

Kiriakos Vlahos

unread,
Jun 30, 2007, 8:02:09 PM6/30/07
to PyScr...@googlegroups.com
Rodolfo,

Thanks for your feedback.  See below for responses.

On 01/07/07, Rodolfo <rhcar...@gmail.com > wrote:

I am new to PyScripter, and I'm so amazed at how it makes my Python
experience better.
Earlier today I got the official 1.7.2 release, and sometime ago
upgraded to v1.8.7.1.

BTW I have three suggestions:

1) It would be useful to be able to choose between normal raw_input
and input and the dialog that pops up on PyScripter. Not the the
dialog isn't good, but just that sometimes I need to move the focus
out of the dialog, which seems impossible.
That is something I am planning to introduce.
 

2) I would like to press Ctrl+C to raise a KeyboardInterrupt.... it's
specially useful when running an infinite loop for some reason, or to
force a program termination. Running a simple code as below freezes
PyScripter:

>>> while 1:
...    print 'Hello world',
When debugging you can press the Abort button, which has some limitations but often works, especially when using the remote Python engine.  (Basically, you need to have at least one breakpoint in the file being executed).

The is also a Timeout property in the IDE options which works when running (not debugging scripts).  I will see what I can do about simulating a keyboard interrupt.
 

3) I tried selecting a interpreter other than "Internal" before I
installed, intentionally before I got RPyC installed, and it throws
out some errors. The only way out is Ctrl+Alt+Del and Terminate
Process...
Maybe there should be a nice error message?
This was due to a regression.  It has been fixed and will be available in the next release.

 

Rodolfo

unread,
Jun 30, 2007, 10:44:36 PM6/30/07
to PyScripter

> 2) I would like to press Ctrl+C to raise a KeyboardInterrupt.... it's
>
> > specially useful when running an infinite loop for some reason, or to
> > force a program termination. Running a simple code as below freezes
> > PyScripter:
>
> > >>> while 1:
> > ... print 'Hello world',
>
> When debugging you can press the Abort button, which has some limitations
> but often works, especially when using the remote Python engine.
> (Basically, you need to have at least one breakpoint in the file being
> executed).

Yes, using a REMOTE engine is much more stable (I see it clear since I
used the version 1.7.2 earlier)
But I was just thinking about the KeyboardInterrupt exception that is
raised when Ctrl+C is pressed on IDLE.
When making scripts that may repeat a task several times I usually put
them inside a

while 1:
try:
[some code]
except KeyboardInterrupt:
break

so that I can manually force a stop by a Ctrl+C....


> The is also a Timeout property in the IDE options which works when running
> (not debugging scripts). I will see what I can do about simulating a
> keyboard interrupt.


Well, the Timeout seems a bit imprecise to me. I just can't think of a
situation where I'll know a maximum time to stop a program....
I mean, I think like if it takes more than X seconds on a loop or
recursion, it should raise an "Exhaustion" error and stop.
But counting from startup time I'm clueless about how many seconds (or
ms) one should set up.

Man, thanks for doing such a great work.

FYI I'll be working with educational games on Python, and I see
PyScripter as a must have now (just don't know what to replace it on a
Linux environment).... could anyone tell me of a good GUI designer
that integrates well with PyScripter (any toolkit is ok)??

Kiriakos Vlahos

unread,
Oct 15, 2007, 8:03:36 AM10/15/07
to PyScr...@googlegroups.com
FYI, the new version 1.9.3.1 implements an Asynchronous interrupt when using the remote engine and now "Reinitialize engine" should work with infinite loops.

Regards

Kiriakos

Rodolfo

unread,
Oct 24, 2007, 9:44:30 AM10/24/07
to PyScripter
Hi there! I got version 1.9.4.0 and have been playing with it for a
while.
I'm on WinXP, and haven't noticed any bugs or crashes people talked
about. It runs very well here :-)

Congratulations for the new features and fixes!
Anyway, I tried reproducing what I did months ago, what originated
this thread.

while 1:
try:
print 'PyScript rules!'
except KeyboardInterrupt:
print 'Loop stopped successfully'
break

When I CTRL+F9 on it (remote python engine) it starts printing
'PyScript rules!', as expected. However, when I use the "Reinitialize
engine" you suggest (CTRL+F2) it gives me a warning window saying the
interpreter is busy and asking to terminate it. Well, it terminates,
but without a KeyboardInterrupt signal, so on the output window I
have:

(...)
PyScript rules!
PyScript rules!
PyScript rules!
PyScript rules!
>>>
*** Remote Interpreter Reinitialized ***
>>>


In fact it means practically nothing since it's such a trivial code,
but still worth mentioning.

Think you'd like to know I've spread the use of PyScripter among my
friends and colleagues throughout these months ;-)
A feature we enjoy and use a lot is clicking on a word and being sent
to another module where it originates! Simply great!

Sincerely yours,

Rodolfo

PyScripter

unread,
Oct 24, 2007, 1:48:10 PM10/24/07
to PyScripter
Thanks for the encouraging comments. Reinitialize interpreter offers
what is says. i.e. a way to terminate a running program and get a
fresh interpreter. Internally it is implemented using an asynchronous
interrupt and hopefully it will offer a similar functionality to a
Keyboard interrupt.
Reply all
Reply to author
Forward
0 new messages