Installing MySQLdb under Cygwin

Jason Tishler jason at tishler.net
Fri Oct 10 16:06:53 EDT 2003


Per,

On Fri, Oct 10, 2003 at 11:09:17AM -0700, Perflubron wrote:
> 7. When I try to import the library, I get the following error:
> Traceback (most recent call last):
>   File "./test.py", line 4, in ?
>     import MySQLdb
>   File "MySQLdb/__init__.py", line 27, in ?
>     import _mysql
> ImportError: dlopen: Win32 error 127

We have the following:

    $ fgrep 127 /usr/include/w32api/winerror.h | head -1
    #define ERROR_PROC_NOT_FOUND 127L

This error usually means the extension module did not export the init
function.  What do you get when you try the following?

    $ objdump -p _mysql.dll | fgrep init

For example:

    $ objdump -p zlib.dll | fgrep init
            [   0] initzlib

If the init function is not being exported, then change the source from:

    void
    init_mysql(void)
    {
        ...
    }

to:

    DL_EXPORT(void) /* for Python 2.2.2, use PyMODINIT_FUNC for Python 2.3+ */
    init_mysql(void)
    {
        ...
    }

> I have seen some posts from people who have managed to install MySQLdb
> on Cygwin - could someone please let me know how to do it?

See the following mailing list thread:

    http://cygwin.com/ml/cygwin/2003-10/msg00462.html

Try the Cygwin list if you need more help.

Jason

-- 
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6





More information about the Python-list mailing list