A package import question

Dan Yamins dyamins at gmail.com
Fri Jun 13 19:01:56 EDT 2008


I'm having a problem importing a package in python, deleting some of what's
been imported, and then reimporting.  (I'm the sure the problem is trivial,
but I just don't understand it.)

I have a directory of python modules called Operations.  It contains a
python module called archive.py.    Here's a import of the archive module
via package import:

  Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53)
  [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import Operations.archive
  >>> Operations.archive
  <module 'Operations.archive' from 'Operations/archive.pyc'>

So  far, so good.

But now, suppose I want to delete Operations.archive.  then, I can't
reimport it.  instead, I

   >>> del Operations.archive
   >>> import Operations.archive
   >>> dir()
     ['Operations', '__builtins__', '__doc__', '__name__']
   >>>

Instead of getting 'Operations.archive', I just seem to get 'Operations'.


I can't seem to be able to import Operations.archive without quitting the
python interpreter and starting again.

What's going on here, and how do I fix it?

Thanks,
Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080613/3e47913f/attachment.html>


More information about the Python-list mailing list