[New-bugs-announce] [issue14290] Importing script as module causes ImportError with pickle.load

Robert report at bugs.python.org
Tue Mar 13 20:40:42 CET 2012


New submission from Robert <bobbyrj3d at gmail.com>:

I implemented a data-structure as an object in a script, let's call it objectScript.py. I'm using this data-structure in other scripts like so:

from objectScript import data-structure

Populating this data-structure requires quite a bit of time, so when I'm done with it, I like to pickle it. However, if I try to load it from the pickled file, I get the following error:

ImportError: No module named objectScript

However, if I replace my 'from objectScript import data-structure' statement with the actual data-structure class definition from the objectScript.py file when I am pickling the object but then revert to the import statement when I am unpickling the object, everything works fine.

----------
components: Library (Lib)
messages: 155651
nosy: rj3d
priority: normal
severity: normal
status: open
title: Importing script as module causes ImportError with pickle.load
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14290>
_______________________________________


More information about the New-bugs-announce mailing list