473,657 Members | 2,593 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 3411
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
12917
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
1992
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
3677
by: Sticks | last post by:
i'm new to python and i was wondering what editors people prefer to use and why.
8
14159
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
7725
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
1787
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
10924
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
2849
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
2997
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
8385
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
8303
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8821
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...
1
8502
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8602
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...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
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
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1601
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.