Can't get MySQLdb to connect

Peter Nikolaidis xy at nikolaidis.com
Sat Aug 30 11:46:08 EDT 2003


Greetings,

	I am attempting to get MySQLdb 0.9.2 installed on Mac OS 10.2 with a 
Fink distribution of Python 2.2.2.  I have seen only a few posts on the 
subject, some of them relate to "conflicting header files," but I don't 
know what to do about conflicting header files, or where I would find 
them, and once I found them, which ones to remove.

	I have compiled MySQL 4.1 and installed into /usr/local/mysql, but 
since have moved to a Fink package installation or 4.0.13.  Although 
MySQLdb appears to install successfully (I think), I am unable to 
connect when I try, as shown below:

 >>> import sys
 >>> import MySQLdb
 >>> conn = MySQLdb.connect (db = 'mydb', host = 'localhost', user = 
'myuser', passwd = 'mypassword')
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "/sw/lib/python2.2/site-packages/MySQLdb/__init__.py", line 63, 
in Connect
     return apply(Connection, args, kwargs)
   File "/sw/lib/python2.2/site-packages/MySQLdb/connections.py", line 
116, in __init__
     self.converter[types.StringType] = self.string_literal
TypeError: object does not support item assignment
 >>>

	My setup.py file contains the following (although I've tried many 
variations, commenting and uncommenting stuff with no real success):

# include files and library locations should cover most platforms
include_dirs = [
#    '/usr/include/mysql',
#	 '/usr/local/include/mysql',
#    '/usr/local/mysql/include/mysql',
	 '/sw/include/mysql'
     ]
library_dirs = [
#    '/usr/lib/mysql',
#	 '/usr/local/lib/mysql',
#    '/usr/local/mysql/lib/mysql',
	 '/sw/lib/mysql', '/sw/lib'
     ]

This is what happens when I build:

running build
running build_py
not copying CompatMysqldb.py (output up-to-date)
not copying _mysql_exceptions.py (output up-to-date)
not copying MySQLdb/__init__.py (output up-to-date)
not copying MySQLdb/converters.py (output up-to-date)
not copying MySQLdb/connections.py (output up-to-date)
not copying MySQLdb/cursors.py (output up-to-date)
not copying MySQLdb/sets.py (output up-to-date)
not copying MySQLdb/times.py (output up-to-date)
not copying MySQLdb/constants/__init__.py (output up-to-date)
not copying MySQLdb/constants/CR.py (output up-to-date)
not copying MySQLdb/constants/FIELD_TYPE.py (output up-to-date)
not copying MySQLdb/constants/ER.py (output up-to-date)
not copying MySQLdb/constants/FLAG.py (output up-to-date)
not copying MySQLdb/constants/REFRESH.py (output up-to-date)
not copying MySQLdb/constants/CLIENT.py (output up-to-date)
running build_ext
skipping '_mysql' extension (up-to-date)

And when I run setup.py install:

running install
running build
running build_py
not copying CompatMysqldb.py (output up-to-date)
not copying _mysql_exceptions.py (output up-to-date)
not copying MySQLdb/__init__.py (output up-to-date)
not copying MySQLdb/converters.py (output up-to-date)
not copying MySQLdb/connections.py (output up-to-date)
not copying MySQLdb/cursors.py (output up-to-date)
not copying MySQLdb/sets.py (output up-to-date)
not copying MySQLdb/times.py (output up-to-date)
not copying MySQLdb/constants/__init__.py (output up-to-date)
not copying MySQLdb/constants/CR.py (output up-to-date)
not copying MySQLdb/constants/FIELD_TYPE.py (output up-to-date)
not copying MySQLdb/constants/ER.py (output up-to-date)
not copying MySQLdb/constants/FLAG.py (output up-to-date)
not copying MySQLdb/constants/REFRESH.py (output up-to-date)
not copying MySQLdb/constants/CLIENT.py (output up-to-date)
running build_ext
skipping '_mysql' extension (up-to-date)
running install_lib
not copying build/lib.darwin-6.6-PowerMacintosh-2.2/_mysql.so (output 
up-to-date)
not copying 
build/lib.darwin-6.6-PowerMacintosh-2.2/_mysql_exceptions.py (output 
up-to-date)
not copying build/lib.darwin-6.6-PowerMacintosh-2.2/CompatMysqldb.py 
(output up-to-date)
not copying build/lib.darwin-6.6-PowerMacintosh-2.2/MySQLdb/__init__.py 
(output up-to-date)
not copying 
build/lib.darwin-6.6-PowerMacintosh-2.2/MySQLdb/connections.py (output 
up-to-date)
not copying 
build/lib.darwin-6.6-PowerMacintosh-2.2/MySQLdb/constants/__init__.py 
(output up-to-date)
not copying 
build/lib.darwin-6.6-PowerMacintosh-2.2/MySQLdb/constants/CLIENT.py 
(output up-to-date)
not copying 
build/lib.darwin-6.6-PowerMacintosh-2.2/MySQLdb/constants/CR.py (output 
up-to-date)
not copying 
build/lib.darwin-6.6-PowerMacintosh-2.2/MySQLdb/constants/ER.py (output 
up-to-date)
not copying 
build/lib.darwin-6.6-PowerMacintosh-2.2/MySQLdb/constants/FIELD_TYPE.py 
(output up-to-date)
not copying 
build/lib.darwin-6.6-PowerMacintosh-2.2/MySQLdb/constants/FLAG.py 
(output up-to-date)
not copying 
build/lib.darwin-6.6-PowerMacintosh-2.2/MySQLdb/constants/REFRESH.py 
(output up-to-date)
not copying 
build/lib.darwin-6.6-PowerMacintosh-2.2/MySQLdb/converters.py (output 
up-to-date)
not copying build/lib.darwin-6.6-PowerMacintosh-2.2/MySQLdb/cursors.py 
(output up-to-date)
not copying build/lib.darwin-6.6-PowerMacintosh-2.2/MySQLdb/sets.py 
(output up-to-date)
not copying build/lib.darwin-6.6-PowerMacintosh-2.2/MySQLdb/times.py 
(output up-to-date)
skipping byte-compilation of 
/sw/lib/python2.2/site-packages/_mysql_exceptions.py to 
_mysql_exceptions.pyc
skipping byte-compilation of 
/sw/lib/python2.2/site-packages/CompatMysqldb.py to CompatMysqldb.pyc
skipping byte-compilation of 
/sw/lib/python2.2/site-packages/MySQLdb/__init__.py to __init__.pyc
skipping byte-compilation of 
/sw/lib/python2.2/site-packages/MySQLdb/connections.py to 
connections.pyc
skipping byte-compilation of 
/sw/lib/python2.2/site-packages/MySQLdb/constants/__init__.py to 
__init__.pyc
skipping byte-compilation of 
/sw/lib/python2.2/site-packages/MySQLdb/constants/CLIENT.py to 
CLIENT.pyc
skipping byte-compilation of 
/sw/lib/python2.2/site-packages/MySQLdb/constants/CR.py to CR.pyc
skipping byte-compilation of 
/sw/lib/python2.2/site-packages/MySQLdb/constants/ER.py to ER.pyc
skipping byte-compilation of 
/sw/lib/python2.2/site-packages/MySQLdb/constants/FIELD_TYPE.py to 
FIELD_TYPE.pyc
skipping byte-compilation of 
/sw/lib/python2.2/site-packages/MySQLdb/constants/FLAG.py to FLAG.pyc
skipping byte-compilation of 
/sw/lib/python2.2/site-packages/MySQLdb/constants/REFRESH.py to 
REFRESH.pyc
skipping byte-compilation of 
/sw/lib/python2.2/site-packages/MySQLdb/converters.py to converters.pyc
skipping byte-compilation of 
/sw/lib/python2.2/site-packages/MySQLdb/cursors.py to cursors.pyc
skipping byte-compilation of 
/sw/lib/python2.2/site-packages/MySQLdb/sets.py to sets.pyc
skipping byte-compilation of 
/sw/lib/python2.2/site-packages/MySQLdb/times.py to times.pyc


	Any help would be greatly appreciated.

Thanks,

Peter






More information about the Python-list mailing list