Mysterious non-module A.sys

R

Robin Becker

I have a package A containing a null __init__.py and a simple module B.py

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

C:\code>python -c"import A.B"
A\B.py
['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']

C:\code>

where does A.sys come from? I tried an experiment and it seems that it's the
import statement in B.py 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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,996
Messages
2,570,237
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top