f



"Error in sys.excepthook" message from Python 2.3 multi-threaded script

Hi,

I've run into an issue which seems to have been discussed previously
on `python-dev` but only in context of Zope3:

    "Fun with 2.3 shutdown" -- Tim Peters
    <http://mail.python.org/pipermail/python-dev/2003-September/038151.html>

The following message is displayed (one or more times) when exiting
(in this case via a `KeyboardInterrupt` exception) a multi-threaded
Python 2.3 script (on Mac OS X 10.2.1):

    """
    Unhandled exception in thread started by
    Error in sys.excepthook:

    Original exception was:
    """

It doesn't always happen consistently. As a comparison, I have run the
same script under Python 2.2.2 and the problem does not seem to occur
there. (Although, of course, with threads that's no guarantee...)

I had a look at the bug list on Sourceforge and this issue doesn't
seem to have made it there yet, so I thought I'd raise it here, partly
as Google-bait and partly to see if I should re-raise the issue on
`python-dev`.

The script in question is a multi-threaded curses framework I'm
developing, and I can post code if that's useful.

--Phil.
0
follower1 (9)
10/27/2003 4:08:42 AM
comp.lang.python 77058 articles. 6 followers. Post Follow

2 Replies
677 Views

Similar Articles

[PageSpeed] 9

follower@iname.com (Follower) wrote in message news:<d2f38965.0310262008.2b170bcf@posting.google.com>...

> The following message is displayed (one or more times) when exiting
> (in this case via a `KeyboardInterrupt` exception) a multi-threaded
> Python 2.3 script (on Mac OS X 10.2.1):
> 
>     """
>     Unhandled exception in thread started by
>     Error in sys.excepthook:
> 
>     Original exception was:
>     """

The problem here is that some threads are still alive and kicking when
the shutdown has reset all module attributes to None.  I've had the
same problem in my test suite for Supybot.

> The script in question is a multi-threaded curses framework I'm
> developing, and I can post code if that's useful.

Exactly.  If I remember correctly, no adequate solution was found on
Python-dev.  You may want to either signal for your threads to die and
wait on their death before actually exiting, if it's an important
issue.

Jeremy
0
10/27/2003 3:12:01 PM
[Follower]
> I've run into an issue which seems to have been discussed previously
> on `python-dev` but only in context of Zope3:
>
>     "Fun with 2.3 shutdown" -- Tim Peters
>
> <http://mail.python.org/pipermail/python-dev/2003-September/038151.html>
>
> The following message is displayed (one or more times) when exiting
> (in this case via a `KeyboardInterrupt` exception) a multi-threaded
> Python 2.3 script (on Mac OS X 10.2.1):
>
>     """
>     Unhandled exception in thread started by
>     Error in sys.excepthook:
>
>     Original exception was:
>     """
>
> It doesn't always happen consistently. As a comparison, I have run the
> same script under Python 2.2.2 and the problem does not seem to occur
> there. (Although, of course, with threads that's no guarantee...)

As explained in the referenced thread, 2.3 is more aggressive about giving
cyclic trash a chance to clean itself up at Python shutdown time, and in
particular calls the cyclic garbage collector after the fundamental sys
module has been mostly destroyed.  Cycles that are broken can allow objects
with __del__ methods to get themselves run, and once we're in a Python-level
__del__ method any number of threads can end up running.  They can end up
referencing other objects that have been destroyed, thus raising exceptions.
The messages Python then wants to print about exceptions in threads can't be
displayed because too much of sys is missing at that time (e.g., sys.stderr
is gone, and so is sys.excepthook), so we get those ridiculous-looking
information-free messages.

> I had a look at the bug list on Sourceforge and this issue doesn't
> seem to have made it there yet, so I thought I'd raise it here, partly
> as Google-bait and partly to see if I should re-raise the issue on
> `python-dev`.

I know I didn't enter an SF bug.  We solved the problem in Zope3 by fixing
bugs in its tests (several tests were being bad citizens, leaving immortal
daemon threads behind; changing the tests to shut down their threads made
the Python shutdown irritations go away).  You shouldn't re-raise it on
python-dev unless you want to suggest a specific solution; a bug report
would be appropriate.


0
tim.one (288)
10/30/2003 10:19:17 PM
Reply:

Similar Artilces:

..\..\Python-2.5.2\Include\pyport.h(117) : fatal error C1189: #error : "Python needs a typedef for Py_ssize_t in pyport.h."
When I try and compile using VS2003 for Release. Compiles fine for Debug. In a hurry (should be gardening). Any solution? TIA Bill ...

OSX / Python 2.3 error"truncated or malformed object ..."
MacOS 10.3.8, Python 2.3. I installed both Tkinter and appscript yesterday. Now when I open python (or pythonw) in the Terminal I get the following: Python 2.3 (#1, Sep 13 2003, 00:49:11) [GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin Type "help", "copyright", "credits" or "license" for more information. /System/Library/Frameworks/Python.framework/Versions/2.3/Resources/Python.app/Contents/MacOS/Python: object: /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/readline.so truncated or malformed ob...

I don't undestand why sometime python (or other) add "tmpWvk7zy" (tmp + random string) after "buildout-eggs" in path of python script
Hi, first, I think that my question is generalist and don't impact only zopeproject and/or Paste package. Instance, when I trace (debug) some scripts, its name is "/home/harobed/ buildout-eggs/tmpWvk7zy/PasteScript-1.3.6-py2.5.egg/paste/script/ serve.py" instead of "/home/harobed/buildout-eggs/PasteScript-1.3.6- py2.5.egg/paste/script/serve.py". I don't understand why and who append "tmpWvk7zy" after "buildout-eggs". I don't know if it's related with python thread support. This trouble is very not useful to debug because pdb can'...

Installing Python 2.3.5
Hi there - when attempting to install Python 2.3.5, I receive the following message -- "You do not have access to make the required system configuration modifications." Please rerun this installation from an administrators account. I am running Windows XP in administrator mode, and have installed versions 4 & 5 with no problems today. What could be hanging this older versions installation up? ...

Python-2.3.3 install -> no "make"
Hi! I 've tryed to install Python-2.3.3 under SuSE 8.0: Unpacking was fine, ../configure seems to be too, but there was no make-file (only "Makefile" but that seems to be something else). What have I forgotten or which fault did I made? How can I handle this problem, what do I have to do to install Python? Kind regards! Frank -- Es schl�ft ein Lied in allen Dingen, Die da tr�umen fort und fort. Die ganze Welt hebt an zu singen, Triffst Du nur das Zauberwort. (Josef von Eichendorff) Frank Dieckmann wrote: > Hi! > > I 've tryed to install Python-2.3...

Float to String "%.7e"
When formatting a float using the exponential format, the rounding is different in Python-2.6 and Python-2.7. See example below. Is this intentional? Is there any way of forcing the Python-2.6 behavior (for compatibility reasons when testing)? >c:\python26\python r:\asiData\abaObjects\lib>c:\python26\python Python 2.6.5 (r265:79096, Mar 19 2010, 18:02:59) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> x = [2.096732130e+02,2.096732140e+02,2.096732150e+02,2.096732151e+02,2.096732160+02] >>> for a in x: .... print ' %.9e %.7e'%(a,a) .... 2.096732130e+02 2.0967321e+02 2.096732140e+02 2.0967321e+02 2.096732150e+02 2.0967322e+02 <<<<<<<< 2.096732151e+02 2.0967322e+02 4.096732160e+00 4.0967322e+00 >>> for a in x: .... print '%.9e %.7e'%(-a,-a) .... -2.096732130e+02 -2.0967321e+02 -2.096732140e+02 -2.0967321e+02 -2.096732150e+02 -2.0967322e+02 <<<<<<<< -2.096732151e+02 -2.0967322e+02 -4.096732160e+00 -4.0967322e+00 >>> ^Z >c:\python27\python Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> x = [2.096732130e+02,2.096732140e+02,2.096732150e+02,2...

"More About Unicode in Python 2 and 3"
http://lucumr.pocoo.org/2014/1/5/unicode-in-2-and-3/ Please don't shoot the messenger :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence I'm so sorry for the mess in my post above, I apologize to all, I accidenta= lly hit return ... I just meant to say that internet programming using ASCII urls is so common= and important that it hurts that Python 3 makes it so much harder. It sure= would be great if Python 3 could be improved to allow such programming to = be done using ASCII urls without...

RE: MySQLDB
Typo in my snippets: > cursor.execute("select * from T where C1 not in (%s)", params) should read cursor.execute("select * from T where C1 not in %s", params) since the converter-functions adds the parens already: > # this is used to translate lists/tuples to (1,2,3) format > # doesn't check to see if contents are actually numeric... > def _converter_set_ids(x, d): > if not len(x): return "(NULL)" > return "(%s)" % ", ".join([str(xx) for xx in x]) Cheerio, Marc. Don't you just want: cursor.execute(&quo...

make test segfaults with "--enable-shared" on Python 2.3.3
Hello, When I use ./configure --with-thread --with-fpectl --with-signal-module \ --with-pymalloc --enable-shared --with-cxx=g++ make test on 2.3.3 I get .... test_queue test_quopri test_random test_re make: *** [test] Speicherzugriffsfehler (Speicherauszug erstellt) gdb ./python core.29964 GNU gdb 5.3.93 Copyright 2003 Free Software Foundation, Inc. .... Reading symbols from /home/devel/compile/Python-2.3.3/build/lib.linux-i686-2.3/pyexpat.so...done. Loaded symbols for /home/devel/compile/Python-2.3.3/build/lib.linux-i686-2.3/pyexpat.so #0 0x400f126c in sre_match (state=0xb...

PB with Python ActiveX Scripting Engine registration (Python 2.2.3/2.3)
I execute the Python program win32com\axscript\client\pyscript_rexec.py and the engine is successfully registered But the python engine isn't active in IE (tested with demo.htm, even after a reboot) I did not have probleme with Python 2.1 and win32all-151 The path of win32com have changed ( now in python 2.2 we have the directory "site-packages" in more) is-it a way??? Thanks for your help PS/ Same probleme with W2K and XP GE wrote: > I execute the Python program win32com\axscript\client\pyscript_rexec.py and > the engine is successfully registered But the python ...

pip install mitmproxy
Greetings To Python-list, I'm trying to install Python package: mitmproxy (https://mitmproxy.org/) on Windows XP SP3. I'm a complete Python newbie. Not planning to do any Python programming at this time. Just trying to get package mitmproxy working (or at least the mitmdump component, since "There is no interactive user interface on Windows." per: http://docs.mitmproxy.org/en/stable/install.html * * * * * * I have installed Python that announces itself on the Python command line as: Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20...

"which python" as a python command?
Hello, I'm trying to find out in a script where the location of the current python is. (I'm writing an installer script in python for a simple server application, so i'm going to do a find-replace in a bunch of files to give them the absolute path of the python binary. One thought might be to use the subprocess module, run "which python" as a subprocess, and then peek at stdout, but that seems way too complicated. Is there a simple solution for this in just a few lines of code? Cheers, Evan chardish@gmail.com wrote: > Hello, > > I'm trying to find out in...

PySide 1.2.2 and Python 3.4.1
--001a11c33dde48e7880501d8d9d9 Content-Type: text/plain; charset=UTF-8 Hello everyone, I have a question regarding PySide 1.2.2 and Python 3.4.1 I have this code <http://pastebin.com/5NXd4Jkk> that I made following a Python tutorial <https://www.youtube.com/watch?v=8D_aEYiBU2c>, mine is a bit different because the tutorial is a bit old, and I'm trying to use Python newest features . As I read in the doc, PySide Signal and Slots now work differently, and I'm trying to use this new way (lines 32 - 34). But, as you guys can see in the pastebin link, it's n...

error compiling python, and "plat-linux2" versus "plat-linux3"
i may have asked about this once upon a time but i'm still fighting with it so i'll throw myself on the mercy of the list and ask again. (and if there's a better forum for this question, let me know.) i'm using the development environment wind river linux 4.2 (hereafter just "WRL") to configure and build an entire embedded system, and that build is failing when it comes to compile python-2.6.2. i *think* i have an idea what the general problem is, but i need help to narrow it down. here's the tail end of the build process: ===== begin snippet ===== Che...

Does Python have equivalent to MATLAB "varargin", "varargout", "nargin", "nargout"?
Thank you in advance for your response. Dmitrey openopt@ukr.net writes: > Thank you in advance for your response. And those do ... ? -- Jorge Godoy <jgodoy@gmail.com> Where you would use varargin and nargin in Matlab, you would use the *args mechanism in Python. Try calling def t1(*args): print args print len(args) with different argument lists Where you would use varargout and nargout in Matlab you would use tuple unpacking in Python. Play with this def t2(n): return tuple(range(n)) a, b = t2(2) x = t2(3) On Feb 18, 12:58 pm, open...@ukr.net wrote: > Th...

"monty" < "python"
>>> "Monty" < "Python" True >>> "Z" < "a" True >>> "Monty" < "Montague" False What's the rule about that? Is it the number of letters or what? thanks --Apple-Mail=_1762AE25-63ED-40EB-876D-A7D495818318 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii =46rom the docs[0]: "Strings are compared lexicographically using the numeric equivalents = (the result of the built-in function ord()) of their characters. Unicode = and 8-bit strings are fully interoperable in this behavior." [0] http://docs.python.org/2/reference/expressions.html#not-in On 20.03.2013, at 14:33, franzferdinand <melo.dumoulin@hotmail.com> = wrote: >>>> "Monty" < "Python" > True >>>> "Z" < "a" > True >>>> "Monty" < "Montague" >=20 > False > What's the rule about that? Is it the number of letters or what? > thanks > --=20 > http://mail.python.org/mailman/listinfo/python-list --Apple-Mail=_1762AE25-63ED-40EB-876D-A7D495818318 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html = charset=3Dus-ascii"></head><body style=3D"word-wr...

MAC SE: "Bomb" "Sys Error" / Address error" at start
Stephen Buggie (505) 863-2390 Psychology Department Univ. of New Mexico, Gallup February 15, 2006 200 College Road Gallup NM 87301 buggie@unm.edu NEED RESCUE DISK! MAC SE -- BOMB System Error / Address Error ------------------------------------------------------------------------------------------------ Dear Macintosh experts, My Mac SE crashes at power-up. I gives the bell-chime, then it proceeds though the launch sequence. After showing two extension-icons, it crashes. Then a dialogue-box shows the BOMB icon with the message, SORRY, A SYSTEM ERROR HAS OCCURRED --- ADDRESS ERROR It never reaches the desktop; this crash occurs every time. The Mac SE has a 330 meg internal hard drive, System 6.x.x, and a 1.4 meg internal 3.5 floppy drive. There is a SCSI port but no internal CD reader. The b/w screen is extremely sharp in its focus. The computer worked fine until about a year ago, when I stupidly put a file in the wrong folder. It has crashed consistently ever since! It has an assortment of software on the hard drive, but I have backups of everything and am willing to reformat the entire hard drive if necessary to get the computer working again! If I can resurrect the computer, I hope to upgrade the system to System 7.0 or 7.1 . DONE SO FAR: Yes, I have launched it with shift-key down, to turn off the extensions, but it always crashes Ive also tried vari...

AT command, "+CMER", I get "+CIEV: 2,3" "+CIEV:2,4" repeat.
Dear All, For AT command, I input +CMER ( set response keypress) to my device, it response +CIEV: 2,5 +CIEV: 2,4 +CIEV: 2,5 +CIEV: 2,4 ..... .... repeat Why? what's the relation? Thank you very much. Boki. On 18 Jan 2005 00:56:40 -0800, boki <bokiteam@ms21.hinet.net> wrote: > Dear All, > For AT command, > > I input +CMER ( set response keypress) to my device, it response > What kind of device is it? -- BOFH excuse #270: Someone has messed up the kernel pointers ...

Python script produces "sem_trywait: Permission denied" #3
Sorry, I probably should have re-stated the problem: We're using Python 2.3.5 on AIX 5.2, and get the follow error messages from some of our code. I haven't yet tracked down exactly where it's coming from: sem_trywait: Permission denied sem_wait: Permission denied sem_post: Permission denied We don't run these scripts as root, so I can't say whether they work as root. I suspect they would, though, since root has permissions to do anything. -- ---------------- Mark E. Hamilton Orion International Technologies, Inc. Sandia National Laboratory, NM. 505-844-7666 Mark...

how to fix error "Requires python(abi)=2.4"
i am installing numpy on fedora with python 2.6,2.7 & 3.1 -- View this message in context: http://python.6.n6.nabble.com/how-to-fix-error-Requires-python-abi-2-4-tp4985031.html Sent from the Python - python-list mailing list archive at Nabble.com. ...

What does """ means in python?
For string, one uses "" to represent string. Below is a code fragment that uses """ instead. cursor.execute("""SELECT name, phone_number FROM coworkers WHERE name=%s AND clue > %s LIMIT 5""", (name, clue_threshold)) What does """ means in python? In article <72a7dd52-7619-4520-991e-20db7ce55ba3@googlegroups.com>, Sam <lightaiyee@gmail.com> wrote: > For string, one uses "" to represent string. Below is a code fragment that > uses """ instead. > > cursor.execute("""SELECT name, phone_number > FROM coworkers > WHERE name=%s > AND clue > %s > LIMIT 5""", > (name, clue_threshold)) > > What does """ means in python? This is what's known as a "triple quoted string" It's just like a regular string, except that it run across newlines. Very handy for things like embedding SQL code in a Python program! It works with single quotes too (i.e. '''this is a very long string spread out over several lines''' Roy Smith wrote: > In article <72a7dd52-7619-4520-991e-20db7ce55ba3@googlegroups.com>, > Sam <lightaiyee@gmail.com...

python said : "1, 2, 3, 6, 7, manbo !"
At the python2.3.2 prompt >>> a = range(8) >>> for b in a: if b == 4: a.remove(b) else: print b 0 1 2 3 6 7 Why 5 does not appear ? (this was the source of a deep bug in a 4000+ lines networked program...) RodrigoB (corrected the identation) > At the python2.3.2 prompt > > >>> a = range(8) > >>> for b in a: > ...........if b == 4: > ................a.remove(b) > ...........else: > ................print b > > > 0 > 1 > 2 > 3 > 6 > 7 > > > Why 5 does not appear ? (this was the source of ...

[Python 2.7.3] What's the difference between these two uses of "for"?
N00b question. But here is the code: http://bin.cakephp.org/view/709201806 In the first example, the first for-loop is run and then the list is assigned to the tricky variable. But, what happens in the second example? Does the loop after "in" get run only once or multiple number of times? On 03/17/2013 05:58 PM, Yves S. Garret wrote: > N00b question. But here is the code: > > http://bin.cakephp.org/view/709201806 > > In the first example, the first for-loop is run and then the list is assigned to the tricky variable. But, what > happens in the second example? Does the loop after "in" get run only once or multiple number of times? Just once. The sorted fn is called just once, and the resulting list is iterated through. In your first case, the list is bound to (assigned to) a name so it is accessible afterwards. In the second case, it is available for garbage collection immediately after the loop finishes. Gary Herron On 2013.03.17 19:58, Yves S. Garret wrote: > N00b question. But here is the code: > > http://bin.cakephp.org/view/709201806 > > In the first example, the first for-loop is run and then the list is assigned to the tricky variable. But, what > happens in the second example? Does the loop after "in" get run only once or multiple number of times? > In the first example, sorted() returns a list, which is assigned to the name tricky (Python doesn...

Access to sys.argv when python interpreter is invoked in some modes like 'python -c "command"'
The python tutorial says "When the script name is given as '-' (meaning standard input), sys.argv[0] is set to '-'. When -c command is used, sys.argv[0] is set to '-c'. " but when we use a command say 'python -c "command"' where can we access "sys.argv" (are there some commands where "sys.argv" is accessed. I can run 'python -c "import sys sys.argv", I get an error message -Tiro poggle.themammal@gmail.com wrote: > The python tutorial says > "When the script name is given as '-' (meaning...

Web resources about - "Error in sys.excepthook" message from Python 2.3 multi-threaded script - comp.lang.python

Resources last updated: 3/25/2016 12:21:04 AM