Why might this happen?
import window; print "LOADED"; data = cPickle.loads(data)
The result is:
LOADED
Traceback (most recent call last):
...
import window; print "LOADED"; data = cPickle.loads(data)
exceptions.ImportError: No module named window
It loads the module fine if I do import window
, but when loading with cPickle
it doesn't seem to work.
For some additional info which is likely relevant:
The module I saved the file in is in project1MODULEsubmodulemain.py
. The window
module is project1MODULEwindow.py
. main.py
begins:
import sys
sys.path.append("..\..")
sys.path.append("..")
...
import window
The module I'm attempting to load from is in project2project2subMODULEdata.py
, with no messing with the sys
path.
MODULE
is the same in both cases: the module I want to load is project2project2subMODULEwindow.py
.
Could the sys.path
appending mess this up somehow?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…