MySQL Forums
Forum List  »  Connector/Python

ImportError: No module named connect‏
Posted by: Tommy Peterson
Date: November 03, 2015 12:04PM

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
import mysql

Some have suggested that I needed to edit the 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 file in /usr/local/lib/python2.4/site-packages/mysql/ has that code already. The 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.

Options: ReplyQuote

Written By
ImportError: No module named connect‏
November 03, 2015 12:04PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.