I run:
$ python setup.py build
$ python setup.py install
which creates a MySQLdb directory at:
/opt/Plone-2.5/Python-2.4.3/lib/Python2.4/site-packages
Then I run:
/opt/Plone-2.5/Python-2.4.3/bin/python
>>> import sys
>>> import MySQLdb
Then I receive the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/opt/Plone-2.5/Python-2.4.3/lib/python2.4/site-packages/PIL/init.py"
, line 19, in ?
Import Error: dynamic module does not define init function (init_mysql)
I have checked the README and FAQs quite carefully although I do admit to being a novice level linux admin.
Any help would be greatly appreciated.
My Platform:
Linux CentOS4 (which I am told is based on RHEL4)
Python 2.4.3
MySQL 4.1.1
GCC 3.4.5
Thanks
-D-
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
MySQLdb has been successfully installed to my Zope Site's instance of python
I have run the Zope's instance of python and successfully imported MySQLdb as a test from the python prompt.
I have copied the ZMySQLDA Product into: /opt/Plone-2.5/lib/python/Products.
When I restart my Zope the ZMySQLDA 2.0.9 Product appears in the Product Management folder,
but is not available in the drop down list.
Out of curiosity and searching for a solution I ran the init.py file in the ZMySQLDA Product folder.
These are the results...
[root@www ZMySQLDA]# /opt/Plone-2.5/Python-2.4.3/bin/python init.py
Traceback (most recent call last):
File "init.py", line 91, in ?
import DA
File "/opt/Plone-2.5/lib/python/Products/ZMySQLDA/DA.py", line 92, in ?
from db import DB
File "/opt/Plone-2.5/lib/python/Products/ZMySQLDA/db.py", line 101, in ?
from Shared.DC.ZRDB.TM import TM
ImportError: No module named Shared.DC.ZRDB.TM
Just to be sure my download of the Product was not corrupted here is the list of files in the ZMySQLDA Product Folder:
browse.dtml DABase.py db.pyc init.py VERSION.txt
CHANGES.txt DA.py DEPENDENCIES.txt Pool.py
connectionAdd.dtml DA.pyc help README.txt
connectionEdit.dtml db.py icons table_info.dtml
Thx in advance
-D-
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'll guess something in your Python compiler flags is stripping out symbols, but I don't really know. Are you using the same GCC as was used to compile Python? In fact, are you using the same python to run as you are to compile? I suspect not, based on your post. Try running setup.py with the same Python your Plone installation uses.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I used the Plone version of Python by using the fully qualified statement:
/opt/Plone-2.5/Python-2.4.3/bin/python /opt/Plone-2.5/MySQL-python-1.2.1_p2/setup.py build
after which I ran:
/opt/Plone-2.5/Python-2.4.3/bin/python /opt/Plone-2.5/MySQL-python-1.2.1_p2/setup.py build
I apologize for the confusion caused by the short form used in my initial post....
Further details of my platform...
On my CentOS4 Linux box I used apt-get to install an rpm that contained "developer tools" which included the gcc mentioned above.
Perhaps there is some necessary component missing???
My Plone/Zope installation was done by running the
Plone2.5 Unified installer build script with the command ./install.sh
Given all of this Im not sure which GCC is being used. But I am definitely using the Python installed along with the Plone Installer.
Thanks for your help
-Darryl-
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I checked my installed rpms against the list of requirements in the Readme doc.
I have:
zlib-devel-1.2.1.2-1.2
openssl-devel-0.9.7a-43.8
gcc-3.4.5-2
I do not have packages:
Mysql-devel
Mysql-shared
python-devel
Mysql and python2.3 were installed as part of the original OS install.
Python2.4.3 was installed as part of the Plone installation
-Darryl-
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have since tracked down and installed the missing rpms:
mysql-devel-4.1.10a-6.cc.i386.rpm
python-devel-2.3.4-14.1.i386.rpm
Re ran the build and install from my Zope/Plone Python 2.4.3 without success
Also tried it from the OS Python2.3 and had no success.
I was careful each time I ran the commands from the Python interface to note which version of Python I was running.
-Darryl-
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You may have to clean out your build directory to ensure everything is built correctly, since you built initially without the necessary devel packages, and doing another build will not actually rebuild anything if the source files haven't changed (i.e. only rebuilds if sources are newer than objects).
If you still have a problem, post the output of setup.py build or send me your crystal ball, tarot cards, oujia board, or whatever it is you prefer for divination, because I can't guess much which one of those things (prefer output).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for your input..
I have since run an upgrade on my kernel and rebuilt my packages.
I am now able to run an import MySQLdb from the python prompt.
Also the ZMySQLDA Product now appears in the Product Management page of my Zope site.
One final issue remains...
The Product is not available in my sites Products listbox so that I cannot add a DB Connection to my site.
Does the ZMySQLDA Product require compiling as well?
Here is the output of my setup.py install...
[root@www MySQL-python-1.2.1_p2]# python setup.py install
running install
running build
running build_py
copying MySQLdb/release.py -> build/lib.linux-i686-2.3/MySQLdb
running build_ext
running install_lib
creating /usr/lib/python2.3/site-packages/MySQLdb
copying build/lib.linux-i686-2.3/MySQLdb/release.py -> /usr/lib/python2.3/site-packages/MySQLdb
creating /usr/lib/python2.3/site-packages/MySQLdb/constants
copying build/lib.linux-i686-2.3/MySQLdb/constants/FIELD_TYPE.py -> /usr/lib/python2.3/site-packages/MySQLdb/constants
copying build/lib.linux-i686-2.3/MySQLdb/constants/FLAG.py -> /usr/lib/python2.3/site-packages/MySQLdb/constants
copying build/lib.linux-i686-2.3/MySQLdb/constants/ER.py -> /usr/lib/python2.3/site-packages/MySQLdb/constants
copying build/lib.linux-i686-2.3/MySQLdb/constants/CR.py -> /usr/lib/python2.3/site-packages/MySQLdb/constants
copying build/lib.linux-i686-2.3/MySQLdb/constants/REFRESH.py -> /usr/lib/python2.3/site-packages/MySQLdb/constants
copying build/lib.linux-i686-2.3/MySQLdb/constants/init.py -> /usr/lib/python2.3/site-packages/MySQLdb/constants
copying build/lib.linux-i686-2.3/MySQLdb/constants/CLIENT.py -> /usr/lib/python2.3/site-packages/MySQLdb/constants
copying build/lib.linux-i686-2.3/MySQLdb/converters.py -> /usr/lib/python2.3/site-packages/MySQLdb
copying build/lib.linux-i686-2.3/MySQLdb/cursors.py -> /usr/lib/python2.3/site-packages/MySQLdb
copying build/lib.linux-i686-2.3/MySQLdb/connections.py -> /usr/lib/python2.3/site-packages/MySQLdb
copying build/lib.linux-i686-2.3/MySQLdb/times.py -> /usr/lib/python2.3/site-packages/MySQLdb
copying build/lib.linux-i686-2.3/MySQLdb/init.py -> /usr/lib/python2.3/site-packages/MySQLdb
copying build/lib.linux-i686-2.3/_mysql_exceptions.py -> /usr/lib/python2.3/site-packages
copying build/lib.linux-i686-2.3/_mysql.so -> /usr/lib/python2.3/site-packages
byte-compiling /usr/lib/python2.3/site-packages/MySQLdb/release.py to release.pyc
byte-compiling /usr/lib/python2.3/site-packages/MySQLdb/constants/FIELD_TYPE.py to FIELD_TYPE.pyc
byte-compiling /usr/lib/python2.3/site-packages/MySQLdb/constants/FLAG.py to FLAG.pyc
byte-compiling /usr/lib/python2.3/site-packages/MySQLdb/constants/ER.py to ER.pyc
byte-compiling /usr/lib/python2.3/site-packages/MySQLdb/constants/CR.py to CR.pyc
byte-compiling /usr/lib/python2.3/site-packages/MySQLdb/constants/REFRESH.py to REFRESH.pyc
byte-compiling /usr/lib/python2.3/site-packages/MySQLdb/constants/init.py to init.pyc
byte-compiling /usr/lib/python2.3/site-packages/MySQLdb/constants/CLIENT.py to CLIENT.pyc
byte-compiling /usr/lib/python2.3/site-packages/MySQLdb/converters.py to converters.pyc
byte-compiling /usr/lib/python2.3/site-packages/MySQLdb/cursors.py to cursors.pyc
byte-compiling /usr/lib/python2.3/site-packages/MySQLdb/connections.py to connections.pyc
byte-compiling /usr/lib/python2.3/site-packages/MySQLdb/times.py to times.pyc
byte-compiling /usr/lib/python2.3/site-packages/MySQLdb/init.py to init.pyc
byte-compiling /usr/lib/python2.3/site-packages/_mysql_exceptions.py to _mysql_exceptions.pyc
Thanks again
-D-
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Previously you had a Python installation in your Plone tree, but it doesn't look like you used it for the above install. If this is the case, ZMySQLDA won't be able to import it. Use the same Python interpreter to build as Plone/Zope will use.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I run:
$ python setup.py build
$ python setup.py install
which creates a MySQLdb directory at:
/opt/Plone-2.5/Python-2.4.3/lib/Python2.4/site-packages
Then I run:
/opt/Plone-2.5/Python-2.4.3/bin/python
>>> import sys
>>> import MySQLdb
Then I receive the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/opt/Plone-2.5/Python-2.4.3/lib/python2.4/site-packages/PIL/init.py"
, line 19, in ?
Import Error: dynamic module does not define init function (init_mysql)
I have checked the README and FAQs quite carefully although I do admit to being a novice level linux admin.
Any help would be greatly appreciated.
My Platform:
Linux CentOS4 (which I am told is based on RHEL4)
Python 2.4.3
MySQL 4.1.1
GCC 3.4.5
Thanks
-D-
MySQLdb has been successfully installed to my Zope Site's instance of python
I have run the Zope's instance of python and successfully imported MySQLdb as a test from the python prompt.
I have copied the ZMySQLDA Product into: /opt/Plone-2.5/lib/python/Products.
When I restart my Zope the ZMySQLDA 2.0.9 Product appears in the Product Management folder,
but is not available in the drop down list.
Out of curiosity and searching for a solution I ran the init.py file in the ZMySQLDA Product folder.
These are the results...
[root@www ZMySQLDA]# /opt/Plone-2.5/Python-2.4.3/bin/python init.py
Traceback (most recent call last):
File "init.py", line 91, in ?
import DA
File "/opt/Plone-2.5/lib/python/Products/ZMySQLDA/DA.py", line 92, in ?
from db import DB
File "/opt/Plone-2.5/lib/python/Products/ZMySQLDA/db.py", line 101, in ?
from Shared.DC.ZRDB.TM import TM
ImportError: No module named Shared.DC.ZRDB.TM
Just to be sure my download of the Product was not corrupted here is the list of files in the ZMySQLDA Product Folder:
browse.dtml DABase.py db.pyc init.py VERSION.txt
CHANGES.txt DA.py DEPENDENCIES.txt Pool.py
connectionAdd.dtml DA.pyc help README.txt
connectionEdit.dtml db.py icons table_info.dtml
Thx in advance
-D-
Look in the Patch section; I believe there is a fix for this problem.
I'll guess something in your Python compiler flags is stripping out symbols, but I don't really know. Are you using the same GCC as was used to compile Python? In fact, are you using the same python to run as you are to compile? I suspect not, based on your post. Try running setup.py with the same Python your Plone installation uses.
I used the Plone version of Python by using the fully qualified statement:
/opt/Plone-2.5/Python-2.4.3/bin/python /opt/Plone-2.5/MySQL-python-1.2.1_p2/setup.py build
after which I ran:
/opt/Plone-2.5/Python-2.4.3/bin/python /opt/Plone-2.5/MySQL-python-1.2.1_p2/setup.py build
I apologize for the confusion caused by the short form used in my initial post....
Further details of my platform...
On my CentOS4 Linux box I used apt-get to install an rpm that contained "developer tools" which included the gcc mentioned above.
Perhaps there is some necessary component missing???
My Plone/Zope installation was done by running the
Plone2.5 Unified installer build script with the command ./install.sh
Given all of this Im not sure which GCC is being used. But I am definitely using the Python installed along with the Plone Installer.
Thanks for your help
-Darryl-
I checked my installed rpms against the list of requirements in the Readme doc.
I have:
zlib-devel-1.2.1.2-1.2
openssl-devel-0.9.7a-43.8
gcc-3.4.5-2
I do not have packages:
Mysql-devel
Mysql-shared
python-devel
Mysql and python2.3 were installed as part of the original OS install.
Python2.4.3 was installed as part of the Plone installation
-Darryl-
I have since tracked down and installed the missing rpms:
mysql-devel-4.1.10a-6.cc.i386.rpm
python-devel-2.3.4-14.1.i386.rpm
Re ran the build and install from my Zope/Plone Python 2.4.3 without success
Also tried it from the OS Python2.3 and had no success.
I was careful each time I ran the commands from the Python interface to note which version of Python I was running.
-Darryl-
You may have to clean out your build directory to ensure everything is built correctly, since you built initially without the necessary devel packages, and doing another build will not actually rebuild anything if the source files haven't changed (i.e. only rebuilds if sources are newer than objects).
If you still have a problem, post the output of setup.py build or send me your crystal ball, tarot cards, oujia board, or whatever it is you prefer for divination, because I can't guess much which one of those things (prefer output).
Thanks for your input..
I have since run an upgrade on my kernel and rebuilt my packages.
I am now able to run an import MySQLdb from the python prompt.
Also the ZMySQLDA Product now appears in the Product Management page of my Zope site.
One final issue remains...
The Product is not available in my sites Products listbox so that I cannot add a DB Connection to my site.
Does the ZMySQLDA Product require compiling as well?
Here is the output of my setup.py install...
[root@www MySQL-python-1.2.1_p2]# python setup.py install
running install
running build
running build_py
copying MySQLdb/release.py -> build/lib.linux-i686-2.3/MySQLdb
running build_ext
running install_lib
creating /usr/lib/python2.3/site-packages/MySQLdb
copying build/lib.linux-i686-2.3/MySQLdb/release.py -> /usr/lib/python2.3/site-packages/MySQLdb
creating /usr/lib/python2.3/site-packages/MySQLdb/constants
copying build/lib.linux-i686-2.3/MySQLdb/constants/FIELD_TYPE.py -> /usr/lib/python2.3/site-packages/MySQLdb/constants
copying build/lib.linux-i686-2.3/MySQLdb/constants/FLAG.py -> /usr/lib/python2.3/site-packages/MySQLdb/constants
copying build/lib.linux-i686-2.3/MySQLdb/constants/ER.py -> /usr/lib/python2.3/site-packages/MySQLdb/constants
copying build/lib.linux-i686-2.3/MySQLdb/constants/CR.py -> /usr/lib/python2.3/site-packages/MySQLdb/constants
copying build/lib.linux-i686-2.3/MySQLdb/constants/REFRESH.py -> /usr/lib/python2.3/site-packages/MySQLdb/constants
copying build/lib.linux-i686-2.3/MySQLdb/constants/init.py -> /usr/lib/python2.3/site-packages/MySQLdb/constants
copying build/lib.linux-i686-2.3/MySQLdb/constants/CLIENT.py -> /usr/lib/python2.3/site-packages/MySQLdb/constants
copying build/lib.linux-i686-2.3/MySQLdb/converters.py -> /usr/lib/python2.3/site-packages/MySQLdb
copying build/lib.linux-i686-2.3/MySQLdb/cursors.py -> /usr/lib/python2.3/site-packages/MySQLdb
copying build/lib.linux-i686-2.3/MySQLdb/connections.py -> /usr/lib/python2.3/site-packages/MySQLdb
copying build/lib.linux-i686-2.3/MySQLdb/times.py -> /usr/lib/python2.3/site-packages/MySQLdb
copying build/lib.linux-i686-2.3/MySQLdb/init.py -> /usr/lib/python2.3/site-packages/MySQLdb
copying build/lib.linux-i686-2.3/_mysql_exceptions.py -> /usr/lib/python2.3/site-packages
copying build/lib.linux-i686-2.3/_mysql.so -> /usr/lib/python2.3/site-packages
byte-compiling /usr/lib/python2.3/site-packages/MySQLdb/release.py to release.pyc
byte-compiling /usr/lib/python2.3/site-packages/MySQLdb/constants/FIELD_TYPE.py to FIELD_TYPE.pyc
byte-compiling /usr/lib/python2.3/site-packages/MySQLdb/constants/FLAG.py to FLAG.pyc
byte-compiling /usr/lib/python2.3/site-packages/MySQLdb/constants/ER.py to ER.pyc
byte-compiling /usr/lib/python2.3/site-packages/MySQLdb/constants/CR.py to CR.pyc
byte-compiling /usr/lib/python2.3/site-packages/MySQLdb/constants/REFRESH.py to REFRESH.pyc
byte-compiling /usr/lib/python2.3/site-packages/MySQLdb/constants/init.py to init.pyc
byte-compiling /usr/lib/python2.3/site-packages/MySQLdb/constants/CLIENT.py to CLIENT.pyc
byte-compiling /usr/lib/python2.3/site-packages/MySQLdb/converters.py to converters.pyc
byte-compiling /usr/lib/python2.3/site-packages/MySQLdb/cursors.py to cursors.pyc
byte-compiling /usr/lib/python2.3/site-packages/MySQLdb/connections.py to connections.pyc
byte-compiling /usr/lib/python2.3/site-packages/MySQLdb/times.py to times.pyc
byte-compiling /usr/lib/python2.3/site-packages/MySQLdb/init.py to init.pyc
byte-compiling /usr/lib/python2.3/site-packages/_mysql_exceptions.py to _mysql_exceptions.pyc
Thanks again
-D-
Previously you had a Python installation in your Plone tree, but it doesn't look like you used it for the above install. If this is the case, ZMySQLDA won't be able to import it. Use the same Python interpreter to build as Plone/Zope will use.
ZMySQLDA is all Python so there is nothing to compile. You need one of the late 2.0.9 betas with MySQLdb-1.2.