ImportError: No module named connect
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.
Subject
Written By
Posted
ImportError: No module named connect
November 03, 2015 12:04PM
November 03, 2015 12:21PM
November 03, 2015 01:21PM
November 06, 2015 09:35AM
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.