Issue15076
Created on 2012-06-15 09:51 by qtld614, last changed 2012-11-03 22:41 by akuchling. This issue is now closed.
| Messages (6) | |||
|---|---|---|---|
| msg162879 - (view) | Author: Leon Zhang (qtld614) | Date: 2012-06-15 09:51 | |
Hello Experts, I am using Python 2.6.2 on a Linux machine. I found sometimes I have problem to run my simple python script. ========> Linux version and Python version <======== leonz@fxcsgbu2c1% uname -a SunOS fxcsgbu2c1 5.8 Generic_117350-06 sun4u sparc SUNW,UltraAX-i2 leonz@fxcsgbu2c1% python Python 2.6.2 (r262:71600, Sep 9 2009, 06:36:48) [GCC 3.4.6] on sunos5 Type "help", "copyright", "credits" or "license" for more information. >> ========> Problem description <======== I have one python script file located at "/usr/autoprog/LogUtility/pygen.py", the first 4 lines are: line 1: #!/usr/bin/python line 2: import sys line 3: import os line 4: import traceback If I just run "python /usr/autoprog/LogUtility/pygen.py" from shell, the script always worked fine. We are running another application called "autotest" on this machine, "autotest" will create a new process and launch Python in this new process (/usr/bin/python /usr/autoprog/LogUtility/pygen.py) to run my Python script. Most of the time, the Python script worked fine, but from some time, for some reason, the script suddenty failed, and from this time, if I run autotest to luanch my python script, it always fails, but if I run the python script from shell, it always works fine. If I reboot this machine, both way to run python script works fine. But after some time, run autotest to luanch python script will fail again... Here is the details of the error message of running autotest to luanch python script: 'import site' failed; use -v for traceback Traceback (most recent call last): File "/usr/autoprog/SGBU/LogUtility/pygen.py", line 19, in <module> import os File "/usr/local/lib/python2.6/os.py", line 49, in <module> import posixpath as path File "/usr/local/lib/python2.6/posixpath.py", line 16, in <module> import warnings File "/usr/local/lib/python2.6/warnings.py", line 6, in <module> import linecache ImportError: No module named linecache ========> Some other information may help <======== I had searched "'import site' failed; use -v for traceback" on internet, there are also many other people have this problem, but I didn't see any useful information to fix my problem. Here are some information about the Python on my machine: Install path is /usr/local/lib/python2.6 There is just one "README" file under /usr/local/lib/python2.6/site-packages Attached is the python script file "pygen.py". Could any expert help me on this problem? Appreciate if any experts can reply me. Thanks. |
|||
| msg163259 - (view) | Author: Leon Zhang (qtld614) | Date: 2012-06-20 06:55 | |
No people help me. |
|||
| msg163269 - (view) | Author: Ramchandra Apte (Ramchandra Apte) * | Date: 2012-06-20 12:09 | |
Well, Python is not able import the linecache module because the file is missing. Check if a file called linecache.py is there in /usr/lib/python2.6 or /usr/local/lib/python2.6 By the way, the python bug tracker doesn't have much experts. :-) |
|||
| msg163270 - (view) | Author: Ramchandra Apte (Ramchandra Apte) * | Date: 2012-06-20 12:09 | |
Try reinstalling Python and see if it works. |
|||
| msg163299 - (view) | Author: Leon Zhang (qtld614) | Date: 2012-06-21 00:24 | |
Thank ramchandra.apte for the help. I checked linecache.py, and the file exists. Unfortunately I don't have root perssion to re-install Python. I also checked another bug "http://bugs.python.org/issue10496", I think that may be the truth. Finally I found another workaround, that is to run my Python from shell. |
|||
| msg174718 - (view) | Author: A.M. Kuchling (akuchling) * ![]() |
Date: 2012-11-03 22:41 | |
Installation bug; nothing to fix. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2012-11-03 22:41:59 | akuchling | set | status: open -> closed nosy: + akuchling messages: + msg174718 resolution: invalid |
| 2012-06-21 00:24:29 | qtld614 | set | messages: + msg163299 |
| 2012-06-20 12:09:49 | Ramchandra Apte | set | messages: + msg163270 |
| 2012-06-20 12:09:11 | Ramchandra Apte | set | nosy:
+ Ramchandra Apte messages: + msg163269 |
| 2012-06-20 06:55:01 | qtld614 | set | messages: + msg163259 |
| 2012-06-20 06:54:17 | qtld614 | set | files: - pygen.py |
| 2012-06-15 09:51:02 | qtld614 | create | |
