Quantcast
Channel: MySQL Forums - Connector/Python
Viewing all articles
Browse latest Browse all 384

ImportError: No module named connect‏ (3 replies)

$
0
0
I have been trying to install the MySQL Connect module for a day and a half.

First I got an error saying that "No module named mysql" was installed. After a lot of trial and error I got passed that. I realized that because I have python installed in /usr/local that I needed to build and then install the library into site-packages where Python was looking. But now it appears that the submodule "connect" cannot be located.

Some people have suggested online that I needed to make sure the module was added to the system path by doing this:

import sys
sys.path.insert(1,'//usr/local/lib/python2.4/site-packages/mysql')
import mysql

Some have suggested that I needed to edit the __init__.py file in /mysql/ with this:
from pkgutil import extend_path
path = extend_path(path, name)

But after I built and then installed pointing to my site-packages directory the __init__.py file in /usr/local/lib/python2.4/site-packages/mysql/ has that code already. The __init__.py in mysql/connector/ has a lot of stuff. It uses dot notation as well which is beyond my rudimentary Python knowledge: for example:
from . import version
from .connection import MySQLConnection

It appears this is related to the install and that I am using /usr/local/lib/python2.4/site-packages. But I am running out of ideas to try. I am not Python expert as you can tell.

Any suggestions?

Again the error in my script where I try to import mysql.connection to connect to mysql is:
import mysql.connect
ImportError: No module named connect

Also I have tried installing it via yum. No go there either.

Viewing all articles
Browse latest Browse all 384

Trending Articles