November 05, 2008

Python in a hosted environment

I have a server that I can't exactly install whatever I want on. I need to be able to talk to a MySQL database from a Python script. I didn't have any of the database interfaces installed, and couldn't install them system-wide. What is a geek to do?

Fortunately, Python's package installer is pretty smart. SO, I created ~/python, and then used ` python setup.py install --root ~/python` to install each module I wanted to install. Next, in my actual code, I used the following to ensure python could find the modules...


import sys
sys.path.append( '/home/hostedby/python/usr/lib64/python2.3/site-packages/' )
sys.path.append( '/home/hostedby/python/usr/lib/python2.3/site-packages/' )


One note: ADOdb requires MySQLdb, but the errors you get from it are completely non-sensical and do not give you even the slightest indication about the inter-dependancy. You could have figured this out by reading the README ,but who does that?

My New Bumper Sticker

I found my new bumper sticker tonight... I'm bitter.

Mostly, I'm bitter that Initiated Measure 11 was defeated. I had really hoped that South Dakota would be the state to re-kindle the Supreme Court decision about abortion. I guess that plaque I have that says, "if you want to make God laugh, tell him your plans," is as accurate now as ever.