[Python-modules-team] Bug#662965: Python doesn't find the connector module -- missing symlinks?

Sandro Tosi morph at debian.org
Wed Mar 7 18:23:00 UTC 2012


On Wed, Mar 7, 2012 at 18:30, David Paleino <dapal at debian.org> wrote:
> On Wed, 7 Mar 2012 18:03:17 +0100, Sandro Tosi wrote:
>
>> On Wed, Mar 7, 2012 at 17:29, David Paleino <dapal at debian.org> wrote:
>> > after installation of said package, python isn't able to find the module:
>> >
>> > $ python -c 'import mysql.connector'
>> > Traceback (most recent call last):
>> >  File "<string>", line 1, in <module>
>> > ImportError: No module named connector
>> > $
>>
>> that's weird because it works on several of my machines and also in a
>> clean pbuilder chroot; have you tried reinstalling it? remove +
>> reinstall?
>>
>> $ python -c 'import mysql.connector as a ; print a.__file__'
>> /usr/lib/pymodules/python2.7/mysql/connector/__init__.pyc
>> $ readlink -f /usr/lib/pymodules/python2.7/mysql/connector/__init__.py
>> /usr/share/pyshared/mysql/connector/__init__.py
>
> This is strange indeed, sorry for not checking before: in a clean chroot, it
> works.
>
> On my host system, I *do* have /usr/lib/pymodules/.../connector/, but python is
> still not seeing it. I'm running it inside an almost-empty /tmp/, so there's no
> chance some local mysql/ directory could interfere with it.
>
> Any hint on how to debug what's happening? Some more info:

the typical problem is a mysql.py in the same dir you are running the
command (. is always inserted at the beginning of sys.path). Else, can
you import only 'mysql'? if yes, where it's pointing to?

$ python -c 'import mysql as a ; print a.__file__'
/usr/lib/pymodules/python2.7/mysql/__init__.pyc

Regards,
-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi





More information about the Python-modules-team mailing list