variable - run python on postgresql




Python and MySQL (2)

I don't have any experience with http://www.SiteGround.com as a web host personally.

This is just a guess, but it's common for a shared host to support Python and MySQL with the MySQLdb module (e.g., GoDaddy does this). Try the following CGI script to see if MySQLdb is installed.

#!/usr/bin/python

module_name = 'MySQLdb'
head = '''Content-Type: text/html

%s is ''' % module_name

try:
    __import__(module_name)
    print head + 'installed'
except ImportError:
    print head + 'not installed'

I can get Python to work with Postgresql but I cannot get it to work with MySQL. The main problem is that on the shared hosting account I have I do not have the ability to install things such as Django or PySQL, I generally fail when installing them on my computer so maybe it's good I can't install on the host.

I found bpgsql really good because it does not require an install, it's a single file that I can look at, read and then call the functions of. Does anybody know of something like this for MySQL?


I uploaded it and got an internal error

Premature end of script headers

After much playing around, I found that if I had

import cgi
import cgitb; cgitb.enable()
import MySQLdb

It would give me a much more useful answer and say that it was not installed, you can see it yourself -> http://woarl.com/db.py

Oddly enough, this would produce an error

import MySQLdb
import cgi
import cgitb; cgitb.enable()

I looked at some of the other files I had up there and it seems that library was one of the ones I had already tried.







bpgsql