[issue17124] import subprocess hangs for ~25 seconds, 700+ files in dir - py 2.7.3, 2.6.6
New submission from Dave Jones: import subprocess hangs for ~25 seconds, 700+ files in dir - py 2.7.3, 2.6.6 I'm running this test from a LiveCD to make sure the environment is relatively clean. -- localhost Desktop # python --version Python 2.7.3 --- works fine here localhost Desktop # cat sp.py #!/usr/bin/python import subprocess print Done... --- localhost Desktop # ls -1 | wc -l 7 --- localhost Desktop # time python sp.py Done... real0m0.027s user0m0.023s sys 0m0.003s --- BUT--- This cannot be right localhost Desktop # mv sp.py .. mv: overwrite `../sp.py'? y localhost Desktop # cd .. localhost jonesda0 # cat sp.py #!/usr/bin/python import subprocess print Done... localhost jonesda0 # time python sp.py 1 Done... real0m25.336s user0m25.270s sys 0m0.014s localhost jonesda0 # ls -1 | wc -l 758 Only change is the number of files in the directory. I have tested this on several different LiveCDs but the results are the same. Is there some sort of flag I need to know about? FWIW, I do not see the problem when using python3.. localhost jonesda0 # yum -y install python3 Loaded plugins: fastestmirror, langpacks, presto, refresh-packagekit ... Installed: python3.i686 0:3.1.2-14.fc14 Dependency Installed: python3-libs.i686 0:3.1.2-14.fc14 Complete! localhost jonesda0 # time python3 sp.py ## (print function...duh) File sp.py, line 5 print Done... ^ SyntaxError: invalid syntax real0m0.048s user0m0.044s sys 0m0.004s localhost jonesda0 # vi sp.py localhost jonesda0 # time python3 sp.py Done... real0m0.091s user0m0.084s sys 0m0.006s localhost jonesda0 # python3 --version Python 3.1.2 -- messages: 181348 nosy: Dave.Jones priority: normal severity: normal status: open title: import subprocess hangs for ~25 seconds, 700+ files in dir - py 2.7.3, 2.6.6 versions: Python 2.6, Python 2.7 ___ 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
[issue17124] import subprocess hangs for ~25 seconds, 700+ files in dir - py 2.7.3, 2.6.6
Dave Jones added the comment: That line (1) seems to pop up every time the subprocess call hangs -- ___ 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
[issue17124] import subprocess hangs for ~25 seconds, 700+ files in dir - py 2.7.3, 2.6.6
Dave Jones added the comment: Distros tested with include Funduntu 2012-4, Fuduntu 2013-1, Fedora 17, Scientific Linux 6.3 OpenSUSE 12.2 (all 32-bit) on the same hardware. -- ___ 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
[issue17124] import subprocess hangs for ~25 seconds, 700+ files in dir - py 2.7.3, 2.6.6
Dave Jones added the comment: I think I found something but I do not know what it means. Everytime the import hangs, it seems to leave behind a time.pyc There are only 29 files in this directory. [jonesda0@linux-2py2 pycode]$ ls -1tr py5.py* py4.py* py3.py* py2.py* py1.py* print_func.py test.py ex3-4.py time.py time2.py sample.py os_test.py params.py changeparam.py parity.py remove_vowels.py sqlite_version.py sqlite_version_with.py sqlite_insert.py sqlite_insert2.py sqlite_friends_last.py sqlite_getall.py dc4g2-report.rpt out_dc4g2-report.rpt num_guess.py report_db_import.py* test-sp.py sp.py test/ [jonesda0@linux-2py2 pycode]$ python sp.py 1 Done... [jonesda0@linux-2py2 pycode]$ ls -1tr py5.py* py4.py* py3.py* py2.py* py1.py* print_func.py test.py ex3-4.py time.py time2.py sample.py os_test.py params.py changeparam.py parity.py remove_vowels.py sqlite_version.py sqlite_version_with.py sqlite_insert.py sqlite_insert2.py sqlite_friends_last.py sqlite_getall.py dc4g2-report.rpt out_dc4g2-report.rpt num_guess.py report_db_import.py* test-sp.py sp.py test/ time.pyc -- ___ 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
[issue17124] import subprocess hangs for ~25 seconds, 700+ files in dir - py 2.7.3, 2.6.6
Ian Cordasco added the comment: As a further note, on python 2.6, I just touched a file called time.py, and in the interpreter imported subprocess. It didn't hang because the file was empty but it did generate a pyc file. This is almost certainly the root of your problem. I doubt this is a core python problem. -- ___ 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
[issue17124] import subprocess hangs for ~25 seconds, 700+ files in dir - py 2.7.3, 2.6.6
Ian Cordasco added the comment: Could you give us the contents of your time.py file? I wonder if there's something in that file that is causing the import to hang. It's the only reason I can think of as to why the time.pyc file shows up. Also, if you want to check before-hand, make a new directory with just those two files and see what happens. -- nosy: +icordasc ___ 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
[issue17124] import subprocess hangs for ~25 seconds, 700+ files in dir - py 2.7.3, 2.6.6
Dave Jones added the comment: Hello Ian. Thank you for the reply. As I imagine you understand, I delete the time.pyc file every time it comes back. That being said, there *is* a time.py script in there from some testing I was doing: [jonesda0@toshiba pycode]$ ls -1tr *.py* | egrep sp|time time.py time2.py test-sp.py sp.py [jonesda0@toshiba pycode]$ cat time.py i = 0 j = 0 while (i 1): # i = i + 1 i+=1 # j = j + 1 j+=1 print j -- [jonesda0@toshiba pycode]$ python sp.py 1 Done... [jonesda0@toshiba pycode]$ ls -1tr *.py* | egrep sp|time time.py time2.py test-sp.py sp.py time.pyc -- I am not calling any sort of time.py anywhere: [jonesda0@toshiba pycode]$ cat sp.py ## still took about 25 seconds import subprocess print (Done...) -- So where does this behavior come from? [jonesda0@toshiba pycode]$ cat time.pyc ## There is all sorts of Escape code in the file, obviously. ���Pc@sdZdZx$edkr2ed7Zed7ZqWeGHdS(ii��iN(titj(((s/home/jonesda0/pycode/time.pymodules [jonesda0@toshiba pycode]$ file time.pyc time.pyc: python 2.7 byte-compiled [jonesda0@toshiba pycode]$ - [jonesda0@toshiba pycode]$ rm -f time.pyc [jonesda0@toshiba pycode]$ mv time.py time.py.bad [jonesda0@toshiba pycode]$ time python sp.py Done... real0m0.027s user0m0.021s sys 0m0.005s [jonesda0@toshiba pycode]$ ls -1tr *.py* | egrep sp|time time.py.bad time2.py test-sp.py sp.py -- Your hypothesis is clearly accurate, but my question is now *WHY*? I was in no way calling a python time function or time.py, it just happened to be in the directory! Thanks -- ___ 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