python module import problems
I have a python module called HTMLTableParse. The directory containing the module is set in PYTHONPATH in ~/.MacOSX/environment.plist. It imports fine when I am running python from the command line or using IDLE.app. However, when I try to run a python module from a cron job, I get this error:
So then I tried setting PYTHONPATH in my crontab. When I did that, it successfully imported HTMLTableParse, but failed on a standard python module:
The bdssb module appears to be in /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5, so I added that path to PYTHONPATH in my crontab. Then I got:
What's going on? What do I need to do to run a python script from cron?
Also, how do I format code in my posts in this forum? I've seen other users do it, but the user help file doesn't describe how to do it. I've settled for using ">", which doesn't look great.
Thanks in advance. I'm desperate to get this to work.
ImportError: No module named HTMLTableParse
So then I tried setting PYTHONPATH in my crontab. When I did that, it successfully imported HTMLTableParse, but failed on a standard python module:
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/shelve. py", line 231, in open
return DbfilenameShelf(filename, flag, protocol, writeback, binary)
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/shelve. py", line 212, in _init_
Shelf. _init_(self, anydbm.open(filename, flag), protocol, writeback, binary)
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/anydbm. py", line 82, in open
mod = _import_(result)
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/dbhash. py", line 5, in ?
import bsddb
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/bsddb/ _init_.py", line 40, in ?
import _bsddb
ImportError: No module named _bsddb
Exception exceptions.AttributeError: "DbfilenameShelf instance has no attribute 'writeback'" in ignored
The bdssb module appears to be in /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5, so I added that path to PYTHONPATH in my crontab. Then I got:
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/re.py", line 97, in ?
import sre_compile
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/sre_compile.py ", line 17, in ?
assert _sre.MAGIC == MAGIC, "SRE module mismatch"
AssertionError: SRE module mismatch
What's going on? What do I need to do to run a python script from cron?
Also, how do I format code in my posts in this forum? I've seen other users do it, but the user help file doesn't describe how to do it. I've settled for using ">", which doesn't look great.
Thanks in advance. I'm desperate to get this to work.
Mac Mini Intel Core Duo, Mac OS X (10.4.4)