MySQLdb not in path causes import Error

Bug #241382 reported by Genu
8
Affects Status Importance Assigned to Milestone
python-mysqldb (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

After upgrading to Ubuntu 8.04 my python MySQLdb module was no longer on sys.path. This would cause an Import Error saying that the python-mysqldb module didn't exist.
The version of python-mysqldb that is installed on my machine, with dselect, is: 1.2.2-5ubuntu1.

Basically the problem here is that the path the python-mysqldb installs to is not included in the default Python module path.

I have found a work around to this by just appending the path to the python-mysqldb module before importing MySQLdb on any script that I need to use MySQLdb.

import sys
sys.path.append("/var/lib/python-support/python2.5")
import MySQLdb

However, I was hoping that there would be a better, more permanent solution to this.

Revision history for this message
wolfger (wolfger) wrote :

Did you try to install the Ubuntu package of python-mysqldb?
Does the problem exist there as well?
Is there a reason you installed with dselect instead of from the repository?

Revision history for this message
Derek Price (derek-ximbiot) wrote :

Yes, Ubuntu's python-mysqldb is installed on this system (Genu was an employee of mine). This is the package this bug was intended to be reported for, since I expected it to either install itself to a directory already in Python's sys.path or perhaps update sys.path automatically, yet it could not be found by scripts.

We use dselect because it is convenient. It is a fairly simple curses wrapper around apt & dpkg (similar to aptitude) and thus does indeed install from the same repository as apt, as specified in /etc/apt/sources.list (which I have not altered from the default Hardy install). I have never had any other package behave differently whether installed via dselect or the command line.

Regardless, I haven't used this system in awhile. I just updated everything and tried again and it appears to be working fine now.

Thanks,

Revision history for this message
wolfger (wolfger) wrote :

Assigning to package python-mysqldb, but also marking invalid since the problem can no longer be reproduced. If the problem reappears, please reopen the ticket by setting the status back to "new".

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.