Hi All,

    I was fiddling here and there with some code doing dynamic import of
stuff, and I noticed that this code:

import os
import sys

init_name = r"C:\Python27\Lib\site-packages\numpy\__init__.py"

directory, module_name = os.path.split(init_name)
main = os.path.splitext(module_name)[0]

sys.path.insert(0, os.path.normpath(directory))

# Crash here...
mainmod = __import__(main)


Produces a hard crash on Python (i.e., a dialog box with a "python.exe has
stopped working" message). I know I am not supposed to import stuff like
that, but I was curious to understand why Python should crash in this way.
This happens on Python 2.7.2 with Numpy 1.6.1 and Python 2.5.4 with Numpy
1.5.0

Thank you for your suggestions :-D


Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

>>> import PyQt4.QtGui
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
ImportError: No module named PyQt4.QtGui
>>>
>>> import pygtk
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
ImportError: No module named pygtk
>>>
>>> import wx
>>>
>>>
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to