Ian Cordasco added the comment:

Dave, at some point during the import of subprocess the time module is 
apparently imported. Because of how imports work, it is importing your local 
copy instead of the standard library version.

I would wager money that if you ran time python time.py (on your script) it 
would take roughly 25 seconds. If I run python verbosely and then import 
subprocess, I get the following output

>>> import subprocess
# /usr/lib64/python2.6/subprocess.pyc matches /usr/lib64/python2.6/subprocess.py
import subprocess # precompiled from /usr/lib64/python2.6/subprocess.pyc
# /usr/lib64/python2.6/traceback.pyc matches /usr/lib64/python2.6/traceback.py
import traceback # precompiled from /usr/lib64/python2.6/traceback.pyc
import gc # builtin
dlopen("/usr/lib64/python2.6/lib-dynload/time.so", 2);
import time # dynamically loaded from /usr/lib64/python2.6/lib-dynload/time.so

That is without the time.py file in the directory. When the file does exist 
there, I get the following:
>>> import subprocess
# /usr/lib64/python2.6/subprocess.pyc matches /usr/lib64/python2.6/subprocess.py
import subprocess # precompiled from /usr/lib64/python2.6/subprocess.pyc
# /usr/lib64/python2.6/traceback.pyc matches /usr/lib64/python2.6/traceback.py
import traceback # precompiled from /usr/lib64/python2.6/traceback.pyc
import gc # builtin
import time # from time.py
# wrote time.pyc

In short, python checks your current working directory for a file to import. If 
it finds it, it uses that first. You can examine the order in which python 
looks for modules and packages by importing sys and looking at sys.path.

This issue can be closed. If you have further questions Dave, feel free to 
email me personally and I'll do my best to answer them.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17124>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to