473,883 Members | 2,143 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Keyboard interrupts, Idle vs. SciTE

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 KeyboardInterru pt:
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 |
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+

Nov 2 '06 #1
4 3425
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
TerminateProces s and displays the message you see.

There is some dead code to call
GenerateConsole CtrlEvent(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
Nov 2 '06 #2
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 KeyboardInterru pt:
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
Nov 3 '06 #3
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.pytho n, 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 |
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+

Nov 3 '06 #4
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 |
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+

Nov 3 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
12944
by: Kerry Neilson | last post by:
For the past couple of months, Idle won't start when I invoke it. I am at a complete loss for why this is. When this happens, they python command line still starts, and python works fine otherwise. Most interesting to me is that a reboot won't fix the problem. But if I just try it again sometime later it will work. Anyone have any ideas? I'm running python 2.3 on windows 2000 professional.
3
2000
by: Brent W. Hughes | last post by:
I want to increase the number of files I can have open in the SciTE editor. The SciTEDoc.html document says to change the number of buffers in a file called SciTE.properties, but it doesn't say specifically how to specify this. So I tried putting this in the properties file: buffers=5 It didn't work. Maybe I need to qualify it in some way, like sys.buffers=5. Does anyone know about this?
32
3707
by: Sticks | last post by:
i'm new to python and i was wondering what editors people prefer to use and why.
8
14188
by: Cyber | last post by:
Hello ! I want to catch any event on a PC by the interrupts (C++ under Linux). My first step is to catch everything from the keyboard. I have: --------------------------------------------------- #include <iostream> #include <csignal> using namespace std;
23
7763
by: herrcho | last post by:
What's the difference between STDIN and Keyboard buffer ? when i get char through scanf, i type in some characters and press enter, then, where do the characters go ? to STDIN or Keyboard buffer ? are they same ? thanks ^^
6
1802
by: MrBlueSky | last post by:
Hi, I'm trying to use IDLE to develop My First Python App and my head hurts... I've a file called spalvi.py with this in it: from Test import * firstTest("Mike") And a file called Test.py with this in it: def firstTest(name): print "Yo",name
16
10961
by: dfaber | last post by:
Hi all, I have been searching for a keyboard and mouse tracker on linux. I've read solutions (watch at sourceforge) which look at /proc/interrupts to check keyboard or mouse activity. I also read one post where "watch" seems to have difficulty tracking usb keyboards and mice. So, I'm out of ideas here. My goal are: 1. Check keyboard activity. I'm not interested in logging which keys are pressed or record them.
2
2856
by: Ryan Liu | last post by:
Hi, In a windows application, What are the APIs to use to detect if the user has not using keyboard or mouse for a while(idle)? And what is the API to know the user just used either one (out of idle)? Can we know it at computer level, or application, or one particular form level? Thanks a lot!
3
3012
by: NaN | last post by:
I've been trying to use _kbhit() but it didn't do what I thought it would from books, "Detects whether a keypress is available for reading." Herbert Schildt says, "If the user has pressed a key, this function returns true(non-0), but does not read the character. If no keystroke is pending, kbhit() returns false (0)." Here is the test code,
0
9945
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
11160
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10766
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10422
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7136
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6007
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4622
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4230
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3241
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.