segfault with imp.load_module()

Neal Norwitz neal at metaslash.com
Sat Apr 5 08:23:50 EST 2003


On Sat, 05 Apr 2003 04:22:51 -0500, Rob Brown-Bayliss wrote:


> Hi, I can do this in interactive python:
> 
>>>> f,n,d = imp.find_module("oda",["./items/"]) print f,n,d
> <open file './items/oda.py', mode 'r' at 0x82c6db8> ./items/oda.py
> ('.py', 'r', 1)
>>>> it = imp.load_module("oda",f,n,d)
>>>> print it
> <module 'oda' from './items/oda.pyc'>
> 
> but this code:
> file, filename, description = imp.find_module(item, ["./items/"]) 
> print file, filename, description
> item_module = imp.load_module(item,file, filename, description)
> file.close()
> 
> gets this:
> 
> [rob at musicbox BHH-V]$ python utils.py 
> <open file './items/oda.py', mode> 'r' at 0x81c2af8> ./items/oda.py 
> ('.py', 'r', 1)
> Segmentation fault

What version of python, what platform, what compiler, what options?
Assuming item = 'oda' this code works for me.

Neal




More information about the Python-list mailing list