Mysterious non-module A.sys

Robin Becker robin at
Tue Jan 10 08:12:19 EST 2006

I have a package A containing a null and a simple module

C:\code>cat A\
import sys
print __file__
print sys.modules.keys()

C:\code>python -c"import A.B"
['copy_reg', 'A.B', 'locale', '__main__', 'site', '__builtin__', 'encodings', 
'os.path', 'A.sys', 'encodings.codecs', 'ntpath', 'UserDict', 
'encodings.exceptions', 'nt', 'A', 'stat', 'zipimport', 'warnings', 
'encodings.types', '_codecs', 'encodings.cp1252', 'sys', 'codecs', 'types', 
'_locale', 'signal', 'linecache', 'encodings.aliases', 'exceptions', 'os']


where does A.sys come from? I tried an experiment and it seems that it's the 
import statement in so if I changed that to import sys,socket I also get 
A.socket so I assume it's the import within import that causes these strange 
modules to appear.

Strangely, attempts to import A.sys fail and its value in sys.modules is None. 
What is the entry for?
Robin Becker

More information about the Python-list mailing list