Re: odd runtime error



On Wed, Dec 1, 2010 at 4:49 PM, David Brown <dmlb2000@xxxxxxxxx> wrote:
So I'm not subscribed to python-list but would like to get an answer
to my question. I've made a small test program that dumps a
RuntimeError and I'd like to know why.

$ python test2.py
doing stuff
Traceback (most recent call last):
 File "test2.py", line 3, in <module>
   import test
RuntimeError: not holding the import lock
child 3693 exited with 256
$

Here's the setup, there's two files test.py and test2.py

$ cat test.py
#!/usr/bin/python

import os, sys

if os.fork() == 0:
       print "doing stuff"
       sys.exit()

print "child %d exited with %d" % os.wait()

It's *quite* strange for a module that's being imported to execute a
fork() in its body; this is almost assuredly the cause of the
RuntimeError. Why are you fork()ing in an importable module in the
first place?

Cheers,
Chris
--
http://blog.rebertia.com
.



Relevant Pages

  • Re: odd runtime error
    ... I've made a small test program that dumps a ... RuntimeError and I'd like to know why. ... $ python test2.py ... $ cat test.py ...
    (comp.lang.python)
  • Re: odd runtime error
    ... I've made a small test program that dumps a ... RuntimeError and I'd like to know why. ... $ python test2.py ... Well, to be specific the fork isn't the cause of the RuntimeError, the ...
    (comp.lang.python)
  • Re: newbie Q: sequence membership
    ... Traceback: ... RuntimeError: maximum recursion depth exceeded in cmp ...
    (comp.lang.python)
  • Re: Help needed: try/except -idiom vs. C-style coding
    ... > a) raise an exception and ... except RuntimeError: ... A more usual way to handle this would be to just print a traceback. ... the exception, but also the route that led to that function. ...
    (comp.lang.python)
  • Re: automatic accessors to a member var dict elements?
    ... >Traceback: ... >RuntimeError: maximum recursion depth exceeded ... >I know there is something different about new style classes in this ...
    (comp.lang.python)