[Zope] FW: MySQLdb outside Zope (Ed Colmar)

Andy Todd Andy.Todd@javelingroup.com
Tue, 25 Feb 2003 17:28:21 -0000


-----Original Message-----
From: Andy Todd=20
Sent: 25 February 2003 17:21
To: 'zope@zope.org'
Cc: 'Ed Colmar'
Subject: Re: MySQLdb outside Zope (Ed Colmar)


> -----Original Message-----
> From: zope-request@zope.org [mailto:zope-request@zope.org]
> Sent: 25 February 2003 17:00
> To: zope@zope.org
> Subject: Zope digest, Vol 1 #2620 - 40 msgs
>=20
>=20
> Send Zope mailing list submissions to
> 	zope@zope.org
>=20
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://mail.zope.org/mailman/listinfo/zope
> or, via email, send a message with subject or body 'help' to
> 	zope-request@zope.org
>=20
> You can reach the person managing the list at
> 	zope-admin@zope.org
>=20
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Zope digest..."
>=20
>=20
> Today's Topics:
>=20
>    1. MySQLdb outside zope (Ed Colmar)
> [snip]
>=20
> --__--__--
>=20
> Message: 1
> Date: Tue, 25 Feb 2003 00:29:11 -0800 (PST)
> To: <zope@zope.org>
> From: Ed Colmar <ed@greengraphics.net>
> Subject: [Zope] MySQLdb outside zope
>=20
>=20
> Hi all...
>=20
> I've got the MySQLdb and ZMySQLDA all up and running on my zope =
install,
> but I can't seem to import the library form my regular python
> interpreter...
>=20
> I have not had any luck compiling it.  I did install the latest rpm, =
but
> still no import in python...
>=20
> Even when launching the python in /usr/local/zope/bin/   it won't
> import...
>=20
> Is there some trick that I'm missing here?
>=20
> I'm trying to follow the devshed Mysql python tutorial...
>
> Thanks for any pointers!
>=20
> -ed-
>=20
> Here are the errors if that helps:
>=20
>=20
> --- system python install ---
> Python 2.2.1 (#1, Sep  9 2002, 09:26:21)
> [GCC 3.2 (Mandrake Linux 9.0 3.2-1mdk)] on linux-i386
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import _mysql
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> ImportError: No module named _mysql
> >>> import MySQLdb
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> ImportError: No module named MySQLdb
>
>
> --- zope python install ---
>=20
> Python 2.1.3 (#1, Sep 19 2002, 13:15:46)
> [GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2
> Type "copyright", "credits" or "license" for more information.
> >>> import _mysql
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> ImportError: No module named _mysql
> >>> import MySQLdb
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> ImportError: No module named MySQLdb
> >>>
>=20
> --=20
> Green Graphics   :::   Print and Web Design   :::   510.923.0000
>=20
> --__--__--
>=20
> [snip]
>=20
> Ed, you've probably got a path issue. First note where the MySQLdb =
directory is installed then start up a=20
> Python interpreter (from /usr/local/zope/bin) and type;
>=20
> >>> import os
> >>> print os.path
>=20
> You will get a list of directories, and the chances are that the =
location of MySQLdb is not in the list. By=20
> the way, don't try and import _mysql that is the old name of the =
module and is only kept around for=20
> backwards compatibility (a.f.a.i.k).
>=20
> HTH,=20
> Andy

And of course I meant;

>>> import sys

And not;

>>> import os

D'oh!

Regards,
Andy