[Tutor] random import errors?

Jay Loden python at jayloden.com
Sat Apr 2 01:20:15 CEST 2005


I have a python script that runs on my webserver every fifteen minutes.  It 
has run for several months with absolutely no problems.  Suddenly, yesterday 
morning I got an email from cron with an import error for sre_constants (see 
below)

I logged in with ssh, manually ran the script and got the same error.  started 
a Python interpreter shell, did "import sre_constants" and got no error.  
Exited, then ran the script again...and got an error importing 'string'.  I 
manually started up Python interpreter again and imported string, again with 
no error.  Then I exited and ran the script, and it ran fine with no errors. 

I got another such email from cron at 2:30am today ... anyone have any idea 
what would cause such a seemingly random problem after months of working 
fine? 

(sample traceback is below)
-Jay

'import site' failed; use -v for traceback
Traceback (most recent call last):
  File "/usr/local/bin/last_update", line 7, in ?
    import os, glob, time
  File "/usr/lib/python2.2/glob.py", line 4, in ?
    import fnmatch
  File "/usr/lib/python2.2/fnmatch.py", line 13, in ?
    import re
  File "/usr/lib/python2.2/re.py", line 27, in ?
    from sre import *
  File "/usr/lib/python2.2/sre.py", line 97, in ?
    import sre_compile
  File "/usr/lib/python2.2/sre_compile.py", line 15, in ?
    from sre_constants import *
ImportError: No module named sre_constants


More information about the Tutor mailing list