Python: from import error -
i'm running python 2.6.6 on ubuntu 10.10.
i understand can import module , bind module different name, e.g.
import spam eggs also,
from eggs import spam foo my problem when running pyside examples, following import code not run:
import pyside pyqt4 pyqt4 import qtcore, qtgui it generates import error:
traceback (most recent call last): file "<stdin>", line 1, in <module> importerror: no module named pyqt4 clearly, according python interpreter above code incorrect, question why incorrect or rather why doesn't work?
import , from special syntax.
they module name, means file in sys.path starts module name.
and seems don't have pyqt4 installed, fail.
the fact have variable called pyqt4 in namespace after running import pyside pyqt4 not change anything, python still looking actual module called pyqt4 when from pyqt4 import qtcore, qtgui.
try doing
import pyside pyqt4 qtcore = pyqt4.qtcore qtgui = pyqt4.qtgui or
import pyside pyqt4 pyside import qtcore, qtgui that should equivalent.
Comments
Post a Comment