This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author icordasc
Recipients Dave.Jones, icordasc, neologix
Date 2013-02-04.21:39:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1360013997.0.0.617382867262.issue17124@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2013-02-04 21:39:57icordascsetrecipients: + icordasc, neologix, Dave.Jones
2013-02-04 21:39:57icordascsetmessageid: <1360013997.0.0.617382867262.issue17124@psf.upfronthosting.co.za>
2013-02-04 21:39:56icordasclinkissue17124 messages
2013-02-04 21:39:56icordasccreate