473,811 Members | 4,032 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Catching a non-Exception object (KeyboardInterr upt)

Hi,

when I try to catch ctrl+c with

except KeyboardInterru pt:

pychecker tells me

Catching a non-Exception object (KeyboardInterr upt)

It works fine, but the message indicates that it's not completely clean.
How should I write the exception correctly?

Thanks,
Michael
Feb 4 '08 #1
2 2076
Michael Goerz <an*******@8439 .e4ward.comwrit es:
when I try to catch ctrl+c with

except KeyboardInterru pt:

pychecker tells me

Catching a non-Exception object (KeyboardInterr upt)
Looks like a pychecker bug. It might be confused by KeyboardInterru pt
being derived not from Exception, but from BaseException.
Feb 4 '08 #2
Hrvoje Niksic <hn*****@xemacs .orgwrote:
Michael Goerz <an*******@8439 .e4ward.comwrit es:
>when I try to catch ctrl+c with

except KeyboardInterru pt:

pychecker tells me

Catching a non-Exception object (KeyboardInterr upt)

Looks like a pychecker bug. It might be confused by KeyboardInterru pt
being derived not from Exception, but from BaseException.
There's a patch for this see:
https://thomas.apestaart.org/thomas/...t=diff&new=938
but it looks like pychecker isn't being maintained because nothing has
changed for more than 2 years.
Feb 4 '08 #3

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

Similar topics

2
4992
by: Olli Piepponen | last post by:
Hi, I'm having a little problem catching keystrokes under Windows. I did a little research and found that with mscvrt.getch() one can cath a single key that is pressed. However this doesn't work when the program is run on the backround and not as the primary task. What I would like to have is a same sort of function that would also work when the program is being run on the background. I'm trying to implement a program that would listen...
2
1753
by: fred | last post by:
Hello, I read a file from several classes and want to catch an EOF when it appears. Having caught the EOF I want to allow the final part of the program to continue rather than just exiting. At present I use methods which read from the file; test the read was successful and return a 1 if not. This is then checked by the calling method, which also returns a 1 if the other method returned 1 (thus
20
2870
by: BigMan | last post by:
On most architectures integer division by 0 results in throwing an exception (does anyone know of one that behaves differently?). I need a way to catch FP division by 0. Is there a standard way to do so?
4
2164
by: interpim | last post by:
ok the function is supposed to accept only non-negative integers... but it still accepts letters input through the function. Such as '23e' still passes through. I tried to use isalpha in the or statement to cause an error, but it causes an error for everything input. How do I make an error occur when anything other than numbers are put in? #include <stdio.h> #define MAXLINE 20 int main(void) { char line; int error,n; do{...
5
2482
by: Philip Hölzenspies | last post by:
Hi All, I have been crunching my brains on this one all day. I use this library that creates output I want, but it can only write it to a file or the stdout. The problem is that I don't want to use the filesystem (permissions, latency through NFS, etc, etc), but a memory buffer. I've been looking for a way to redirect stdout to a buffer that I manage myself. Obviously I considered setbuf (from stdio.h), but then I'ld still have to...
5
2611
by: lord.zoltar | last post by:
How can I prevent the big close button in the top of the window from closing the window? I want to have and "are you sure?" confirmation so the user must press "Yes" before the program ends. Right now, I've tried catching the FormClosing and FormClosed events. The message box appears at the right time, but since the form is already closing, it doesn't matter if the user presses "Yes" or "No". how do I cancel the FormClosing?
9
1834
by: Steve Folly | last post by:
Hi, I had cause to change a base class virtual method's signature from const to non-const and realised the compiler didn't warn me about derived classes that hadn't changed: class Base { public:
25
2375
by: JJ | last post by:
I only want to catch 404 errors at the application level (the rest are will be handled by the customerrors section of the web.config). How do I check for the error code in the Application_Error of Global.asax ? Thanks, JJ
42
7039
by: thomas.mertes | last post by:
Is it possible to use some C or compiler extension to catch integer overflow? The situation is as follows: I use C as target language for compiled Seed7 programs. For integer computions the C type 'long' is used. That way native C speed can be reached. Now I want to experiment with raising a Seed7 exception (which is emulated with setjmp(), longjmp() in C) for integer
39
2839
by: mathieu | last post by:
Hi there, I am trying to reuse a piece of code that was designed as an application. The code is covered with 'exit' calls. I would like to reuse it as a library. For that I renamed the 'main' function into 'mymain', but I am stuck as to what I should do for the 'exit'. AFAIK there is no portable way to catch the exit. The only thing I can think of is atexit, but that does not work since 'exit' is still called afterward.
0
9734
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
9607
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
10656
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
10413
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
6897
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
5700
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4353
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
3879
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3027
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.