| | |
Windows Vista Signals
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Sep 2008
Posts: 1
Reputation:
Solved Threads: 0
Thanks in advance for the help.
I’m fairly new to Python so please forgive me if I don’t quite use the correct terminology.
I have a very simple serial port interface (non-gui) application that I run on windows. Upon closing the window, I want the program to run some cleanup code (ie. Close output files and ports). Originally, on Windows XP (32-bit), using the SIGBREAK signal, it runs my cleanup code as expected when the ‘X’ in the top right corner of the window is pressed. When I run the same program on Windows Vista, it does not run the cleanup code when the window is closed. CTRL+C on both operating systems run the cleanup code as expected. Here is a sample:
Does anyone know any way that I can run cleanup code on a windows vista machine when the window is closed via the ‘X’ in the top right corner of the screen?
By the way, I've also tried the atexit module and the try: except: finally: any they didn't work either. Maybe I'm not using them correctly
Thanks again.
I’m fairly new to Python so please forgive me if I don’t quite use the correct terminology.
I have a very simple serial port interface (non-gui) application that I run on windows. Upon closing the window, I want the program to run some cleanup code (ie. Close output files and ports). Originally, on Windows XP (32-bit), using the SIGBREAK signal, it runs my cleanup code as expected when the ‘X’ in the top right corner of the window is pressed. When I run the same program on Windows Vista, it does not run the cleanup code when the window is closed. CTRL+C on both operating systems run the cleanup code as expected. Here is a sample:
Python Syntax (Toggle Plain Text)
def cleanup(signum, frame): # cleanup code here print "programmed cleaned up" signal.signal(signal.SIGBREAK, cleanup) signal.signal(signal.SIGABRT, cleanup) signal.signal(signal.SIGINT, cleanup) signal.signal(signal.SIGTERM, cleanup) signal.signal(signal.SIGFPE, cleanup) signal.signal(signal.SIGILL, cleanup) signal.signal(signal.SIGSEGV, cleanup)
Does anyone know any way that I can run cleanup code on a windows vista machine when the window is closed via the ‘X’ in the top right corner of the screen?
By the way, I've also tried the atexit module and the try: except: finally: any they didn't work either. Maybe I'm not using them correctly
Thanks again.
![]() |
Other Threads in the Python Forum
- Previous Thread: Getting size of all files in folder, and finding out some offsets..
- Next Thread: Calling a random function
Views: 681 | Replies: 0
| Thread Tools | Search this Thread |
Tag cloud for Python
approximation array beginner book builtin change cipher clear client code color converter countpasswordentry cturtle curved def dictionary drive dynamic examples excel file float format ftp function gui homework import inches input java library line lines linux list lists loop microcontroller mouse mysqldb mysqlquery newb number numbers output parsing path plugin port prime program programming projects py2exe pygame pymailer pyqt python random recursion recursive redirect remote script scrolledtext search singleton socket sqlite ssh string strings strip subprocess sum syntax table terminal text textarea thread threading time tkinter tlapse tuple tutorial twoup ubuntu unicode urllib urllib2 variable vigenere wikipedia windows wxpython xlwt





