[Ironpython-users] Steps to reproduce crash (Was: Problem during "from mymodule import *")

MarkusSchaber msr at schabi.de
Sat Aug 13 20:07:29 CEST 2011


Hi,

I finally managed to nail the problem down to a small self-contained
example. (It seems not related to the from...import * statement as my
first thought was. It seems the tracing hooks which pointed me to the
source were not printing out the statement actually causing the
crash.)

Put the following two files into an empty directory with write
permission. Running test2.py with IronPython 2.6 or cPython 2.7
creates the Temp directory as expected, running it with IronPython
2.7.1 beta 2 crashes.

-- test2.py --
# test script...

import sys, io, utils

def trace_handler(a,b,c):
    return trace_handler;

sys.settrace(trace_handler)

utils.ensure_tempdir()
utils.ensure_tempdir()

print "script finished."
-- -- --

-- utils.py --
# Utilities for other test scripts.

import os, shutil

DIR = os.path.dirname(__file__)

def makepath(otherpath):
    return os.path.join(DIR, otherpath)

TEMP = makepath("Temp")

def ensure_tempdir():
    if not os.path.isdir(TEMP):
        os.makedirs(TEMP)
    else:
        for root, dirs, files in os.walk(TEMP):
            for f in files:
                try:
                    os.remove(os.path.join(root, f))
                except:
                    pass
            for d in dirs:
                shutil.rmtree(os.path.join(root, d),
ignore_errors=True)
-- -- --

HTH,
Markus



More information about the Ironpython-users mailing list