del on modules

rihad rihad at mail.ru
Mon Jan 14 04:23:42 EST 2002


I have...

d:\dir0\
    __init__.py
    mod.py

mod.py has var = 6

now I say...

C:\Python22>python
Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.append('d:\\')
>>> import dir0.mod
>>> dir0.mod.var
6
>>> del dir0.mod
>>> import dir0.mod
>>> dir0.mod.var
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: 'module' object has no attribute 'mod'
>>> dir(dir0.mod)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: 'module' object has no attribute 'mod'
>>> dir(dir0)
['__builtins__', '__doc__', '__file__', '__name__', '__path__']
>>>


Where did mod go? OK, I delled it, but why doesn't import dir0.mod
bring it back to life?

advTHANKSance!




More information about the Python-list mailing list