After hours of searching and hitting the walls with the following error:
File "build/bdist.macosx-10.3-i386/egg/MySQLdb/__init__.py", line 19, in
File "build/bdist.macosx-10.3-i386/egg/_mysql.py", line 7, in
File "build/bdist.macosx-10.3-i386/egg/_mysql.py", line 6, in __bootstrap__
ImportError: dlopen(/Users/oleksii/.python-eggs/MySQL_python-1.2.2-py2.5-macosx-10.3-i386.egg-tmp/_mysql.so, 2): image not found
I finally decided just to look on what actually was in the .python-eggs folder. Rrrriiight:
-rw------- 1 oleksii oleksii 123024 Sep 20 2008 _mysql.so
Isn’t this just beautiful? I don’t get why it is created under my user anyway while Apache2 is running under different user, but since the created library was only readable by me myself… Well, Apache just couldn’t get to it. Damn. What a loss of time (simply not mentioning all previous frustrations with installs, etc).
Original date: 2008-12-27
Apparently using the TIMESTAMP fields in the MySQL the MySQLdb library in python results in the
datetime.datetime() objects. A valid value can be set by providing a valid
Quick and dirty prototyping in python instead of PHP (+MySQL).
Original date: 2008-12-22
I have spent a lot of time trying to figure out how to get my time registration app (php + mysql) up and running on my old FreeBSD laptop. After several unsuccessful attempts, abscence of properly installed mod_php and perhaps a lot of other things gave up. I can quickly do the minimal thingy using python!
I have added .py to the cgi script handlers:
AddHandler cgi-script .py
Made a simple script to connect to the MySQL database, but it failed miserably. No output was generated. After several attempts it seems that the import statement fails. Ok, put a try/except clause around and output the result. Hmmm, the result is rather interesting:
(Can’t extract file(s) to egg cache The following error occurred while trying to extract file(s) to the Python egg cache: [Errno 13] Permission denied: ‘/nonexistent’ The Python egg cache directory is currently set to: /nonexistent/.python-eggs Perhaps your account does not have write access to this directory? You can change the cache directory by setting the
PYTHON_EGG_CACHE environment variable to point to an accessible directory. )
Ok, it seems that my www user (which does not have any home folder of course!) attempts to create cache folder under his (non-existing) home folder. Adding (perhaps not very secure)
SetEnv PYTHON_EGG_CACHE /tmp/apache/
to the virtual host configuration helped for now (you need mod_env for this). The cache can be created.
Ideally you would need a proper home directory with a restricted access for the apache user account.
If the server comes up with a very descriptive message like
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
This may simply means that your beauty (script) contains just a small typo. Very handy indeed. The following two lines help a lot: