473,698 Members | 2,398 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: Unusual Exception Behaviour

mk
http://linux.byexamples.com/archives...eption-traceba
ck-into-log-file/
>if __name__=="__ma in__":
try:
main()
except:
print "Trigger Exception, traceback info forward to log file."
traceback.print _exc(file=open( "errlog.txt","a "))
sys.exit(1)

I've just given this solution a shot but I still seem to get the same
result, it suddenly starts dumping the log data to the command line, and
nothing gets printed in error.txt apart from the keyboard interrupt from
when I kill the application.
That's seriously weird. What's your Python version and platform? On my
Windows and Linux machines, with more recent Python versions the above
trick works flawlessly.

Check your environment, namely PYTHON* variables. There may be something
causing this behaviour. Unset them.

Check the first line of your scripts. If you're calling wrong Python
interpreter (there may be more than one in the system for some reason),
this may cause it.

You could also try setting up PYTHONINSPECT environment variable or run
the python interpreter with -i option before program filename, which
drops you into an interactive shell upon exception or termination of a
program.
For some reason the exceptions don't seem to be raised properly so obviously
aren't being caught at this higher level.

So confusing.
This behavior is seriously unusual for Python. Maybe you have some old /
buggy version?


Jul 17 '08 #1
0 1111

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

Similar topics

0
786
by: mk | last post by:
Robert Rawlins wrote: Sure. I'm a little confused as to how I can modify that Remember, Google is your friend, here's the crux of the method without the fancy schmancy sugar coating:
0
213
by: Robert Rawlins | last post by:
That's seriously weird. What's your Python version and platform? On my Thanks for that MK. I'm using Debian with Python 2.5 from the stable apt repository, installed but a couple of days ago. I'll be sure to look into those other elements you suggested also. I'm not sure if it bares any resemblance but this application runs a gobject mainloop and uses dbus quite extensively. Don't think this might have something to do with the way I...
0
200
by: Robert Rawlins | last post by:
>That's seriously weird. What's your Python version and platform? On my repository, installed but a couple of days ago. I'll be sure to look into those other elements you suggested also. I'm not sure if it bares any resemblance but this application runs a gobject mainloop and uses dbus quite extensively. configured do you? For some reason it sits in my mind that this issue started when I moved my logging configuration from...
3
2030
by: Robert Rawlins | last post by:
Hi Mk, Yeah it's got me a little bemused to be honest, I've tried playing around with configuration options this morning and not been able to achieve anything that works properly. I'll keep testing though and as soon as I have a root cause to the problem I'll be sure to let the list know.
0
9166
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
9030
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...
1
8899
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
8871
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
7737
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6525
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
4371
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4621
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2333
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.