I am trying to use the "imp" library to export all symbols of PyQt4. Use the built-in "import PyQt4.QtCore" is OK, but the python's code failed. My Test is basing on Mac. On Windows, it seems that if you put one "init.py" (empty file is OK) under the QtCore directory, "import QtCore" will success. But on Mac, for some unknown reason, it failed. In the Cli:
bash-3.2# python
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt4.QtCore as f
>>> print f.__file__
/Library/Python/2.7/site-packages/PyQt4/QtCore.so
However, this usage failed.
bash-3.2# cd /Library/Python/2.7/site-packages/PyQt4/
bash-3.2# python
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import QtCore
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
SystemError: dynamic module not initialized properly
Can someone explains it?