473,398 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Restart crashing modules in windows

Hi,
I have a python module that keeps on crashing with various windows
errors (not BSOD but the less lethal windows XP popup ones). Now these
are intentional and rather sporadic so I cant really solve it by
attempting to fix the crash; rather what Im trying to do is make another
module outside it that restarts this module every time it crashes. Is
this possible? How do I do this? Or does one windows crash in one python
module crash python entirely and I have to resort in an external program
to restart python everytime it crashes?
Thanks again for all the help.
Astan
Jan 15 '08 #1
2 2393
On Jan 14, 9:02 pm, Astan Chee <st...@al.com.auwrote:
Hi,
I have a python module that keeps on crashing with various windows
errors (not BSOD but the less lethal windows XP popup ones). Now these
are intentional and rather sporadic so I cant really solve it by
attempting to fix the crash; rather what Im trying to do is make another
module outside it that restarts this module every time it crashes. Is
this possible? How do I do this? Or does one windows crash in one python
module crash python entirely and I have to resort in an external program
to restart python everytime it crashes?
Thanks again for all the help.
Astan
If you're not going to catch the error that is causing the crash, then
I think your only option is to restart your application with an
external program. However, maybe someone else will have a better idea.

Mike
Jan 15 '08 #2
On Jan 15, 2008 5:08 PM, Astan Chee <st***@al.com.auwrote:
>
Mike Driscoll wrote:
On Jan 14, 9:02 pm, Astan Chee <st...@al.com.auwrote:
Hi,
I have a python module that keeps on crashing with various windows
errors (not BSOD but the less lethal windows XP popup ones). Now these
are intentional and rather sporadic so I cant really solve it by
attempting to fix the crash; rather what Im trying to do is make another
module outside it that restarts this module every time it crashes. Is
this possible?

If you're not going to catch the error that is causing the crash, then
I think your only option is to restart your application with an
external program.

My understanding of using an external application to do this is to first
create my module as an executable using py2exe. Then I have another python
script that runs this module like this

while (1):
os.popen("program_module.exe")

and make this other python script into another executable and execute this
one. If Im not mistaken, when the python program crashes, the thread is
killed. is this correct or how should I do it?
Thanks again.
Astan
You'll have to look in Windows Task Manager and see if your
"program_module.exe" is listed after the crash. Press CTRL+Shift+ESC,
right-click a blank spot on the taskbar and choose Task Manager or
press CTRL+ALT+DEL to open it. If your program is not listed, then the
thread is "killed" so-to-speak. Otherwise, it's most likely hung and
you'll have to select it and choose End Process to kill it.

If it is not hung, then you can use the os.popen method to restart it,
but you should really look at subprocess.Popen() instead as it
supersedes os.popen() as of Python 2.4. See http://docs.python.org/lib/module-subprocess.html
for more info.

You might also take a look at IDLE's code as it has a way of stopping
a script using CTRL+C and restarting itself into its original state.

Mike
Jan 16 '08 #3

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

Similar topics

5
by: Meelis Lilbok | last post by:
Hi Is it possible restart IIS from ASP? I tryed activex dll, but it wont work, i think its an "user rights" problem When i use this dll form vb6 all works fine. Any other solution? Best...
13
by: python | last post by:
hello and thanks for reading this, i have been a dos/windows user using some form of the basic language for 30 years now. i own and run a small programming company and there is one feature that...
6
by: Leonardo Curros | last post by:
Hello, I would like to know what's the best way to restart one service. I would like to do it from the service itself. Is this possible? I try it with ServiceController.stop()...
3
by: Mark | last post by:
Hello, What I need to know is if there is a better method to run/edit modules on my pc. I'm currently running the IDLE shell under Python 2.5, on Windows XP. Every time I edit my .txt or .py...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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,...
0
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...
0
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...

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.