Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Keyboard interrupts, Idle vs. SciTE

Reply
Thread Tools

Keyboard interrupts, Idle vs. SciTE

 
 
John Ladasky
Guest
Posts: n/a
 
      11-02-2006
Hi there.

The following minimal code in Python 2.3.4 works under Idle v. 1.0.3,
but not under SciTE v. 1.66:

from time import sleep
try:
while True:
sleep(0.25)
print ".",
except KeyboardInterrupt:
print "\nKeyboard interrupt received. Exiting program.\n\n"


Under SciTE, I do not get my "exiting program" message. Instead, I get
the standard SciTE abort message:


>Process failed to respond; forcing abrupt termination...
>Exit code: 1



I much prefer the SciTE environment to Idle. Is there any way that I
can rewrite my program to restore the keyboard interrupt function under
SciTE? Alternately, is there some setting that I can change in SciTE
to accomplish the same effect?

Thanks for your input!


+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
| Ladasky Home Solar, Inc.: blowing sunshine up your |
| power grid since March 24, 2005. Fiat lux! |
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
| Uptime Downtime kWh generated kWh consumed |
| 584 days 6.5 hours 10953 10982 |
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+

 
Reply With Quote
 
 
 
 
Neil Hodgson
Guest
Posts: n/a
 
      11-02-2006
John Ladasky:

> Under SciTE, I do not get my "exiting program" message. Instead, I get
> the standard SciTE abort message:
>
>
>> Process failed to respond; forcing abrupt termination...
>> Exit code: 1

>
>
> I much prefer the SciTE environment to Idle. Is there any way that I
> can rewrite my program to restore the keyboard interrupt function under
> SciTE? Alternately, is there some setting that I can change in SciTE
> to accomplish the same effect?


This is on Windows - its generally a good idea to say which platform
you are using. SciTE runs Python as an external process and tries to
interrupt by writing a Ctrl+Z to the input of the running process which
works for many interactive programs. If that fails, it calls
TerminateProcess and displays the message you see.

There is some dead code to call
GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT... in scite/src/SciTEWin.cxx
that you could try to enable and rebuild SciTE.

Idle may be running the code in-process but even if it is running it
out of process in debugging mode, it still has much more knowledge of
the execution environment. SciTE uses the same code for running Python
as for running grep or javac.

Neil
 
Reply With Quote
 
 
 
 
robert
Guest
Posts: n/a
 
      11-03-2006
John Ladasky wrote:
> Hi there.
>
> The following minimal code in Python 2.3.4 works under Idle v. 1.0.3,
> but not under SciTE v. 1.66:
>
> from time import sleep
> try:
> while True:
> sleep(0.25)
> print ".",
> except KeyboardInterrupt:
> print "\nKeyboard interrupt received. Exiting program.\n\n"
>
>
> Under SciTE, I do not get my "exiting program" message. Instead, I get
> the standard SciTE abort message:
>
>
>> Process failed to respond; forcing abrupt termination...
>> Exit code: 1

>
>
> I much prefer the SciTE environment to Idle. Is there any way that I
> can rewrite my program to restore the keyboard interrupt function under
> SciTE? Alternately, is there some setting that I can change in SciTE
> to accomplish the same effect?


Use PythonWin on Windows. It is based on the same Scintilla editor, but provides real interaction and inline script execution capabs, debugging ...
SciTE catches only stdout ( sometimes ) etc.

robert
 
Reply With Quote
 
John Ladasky
Guest
Posts: n/a
 
      11-03-2006
Thanks for the SciTE info, Neil.

Yes, it was silly of me to forget to state that I'm using Win32.
Normally, when I post to comp.lang.python, I remember to include that
fact... :^P

+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
| Ladasky Home Solar, Inc.: blowing sunshine up your |
| power grid since March 24, 2005. Fiat lux! |
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
| Uptime Downtime kWh generated kWh consumed |
| 584 days 6.5 hours 10953 10982 |
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+

 
Reply With Quote
 
John Ladasky
Guest
Posts: n/a
 
      11-03-2006
Thanks Robert, I just poked around and found a PythonWin web page:

http://aspn.activestate.com/ASPN/doc...in/readme.html

>From other links it appears that SciTE was based on PythonWin, and not

the other way around. For people coding in other languages besides
Python, switching from SciTE to PythonWin might be a step backward.
But probably not for me. I'll give it a try.

+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
| Ladasky Home Solar, Inc.: blowing sunshine up your |
| power grid since March 24, 2005. Fiat lux! |
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
| Uptime Downtime kWh generated kWh consumed |
| 584 days 6.5 hours 10953 10982 |
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
idle mac os x international keyboard umlaut input Some Friend Python 2 01-09-2012 05:58 AM
Configure SciTE - accept keyboard inut Steven Taylor Ruby 1 04-16-2009 10:42 AM
Keyboard error or no keyboard present??? Bud Light Computer Support 2 01-22-2005 04:00 AM
Jython and SciTE rt lange Python 1 01-21-2004 07:57 PM
SciTE srijit@yahoo.com Python 3 09-19-2003 10:31 AM



Advertisments