MySQLdb compiled -- Import issue

Discussion in 'Python' started by Kurian Thayil, Mar 25, 2010.

  1. Hi All,

    I am just a month old with Python and trying to learn CGI with Python. I
    was trying to install MySQLdb module in my new CentOS 5.3 box with
    Python 2.4.3 default install. I downloaded the tar-ball of MySQLdb
    module (MySQL-python-1.2.3c1). Did build as normal user and install as
    root. MySQL server version that I'm using is 5.1.41, if that has
    anything to do with the error. I then copied, libmysqlclient_r.so.16
    library to /usr/lib/ folder and then I am able to import the module as
    root user. But cannot do this as normal user.

    Now, while doing import MySQLdb as normal user, I get the following
    error message. The scripts will be run as apache and hence cannot have
    this error. Please check the following output. Also I have attached the
    output while doing build and install process.

    [kurianmt@server MySQL-python-1.2.3c1]$ python
    Python 2.4.3 (#1, Jan 21 2009, 01:10:13)
    [GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import MySQLdb

    /usr/lib/python2.4/site-packages/MySQL_python-1.2.3c1-py2.4-linux-i686.egg/_mysql.py:3: UserWarning: Module _mysql was already imported from /usr/lib/python2.4/site-packages/MySQL_python-1.2.3c1-py2.4-linux-i686.egg/_mysql.pyc, but /opt/downloads/py-modules/MySQL-python-1.2.3c1 is being added to sys..path

    It would be a great help if I understand what's going on!!! Thanks in
    advance.

    Regards,

    Kurian Mathew Thayil.

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.10 (GNU/Linux)

    iEYEABECAAYFAkuq0ZUACgkQmpp12uIyOU+t8ACdGDJ5Lxc5lLLe8cySe7VyM0un
    yroAoJ+4sHIsB4+oVjSuM7gYGsCKCXua
    =6RY3
    -----END PGP SIGNATURE-----
     
    Kurian Thayil, Mar 25, 2010
    #1
    1. Advertising

  2. Kurian Thayil

    Sean DiZazzo Guest

    On Mar 24, 7:59 pm, Kurian Thayil <> wrote:
    > Hi All,
    >
    > I am just a month old with Python and trying to learn CGI with Python. I
    > was trying to install MySQLdb module in my new CentOS 5.3 box with
    > Python 2.4.3 default install. I downloaded the tar-ball of MySQLdb
    > module (MySQL-python-1.2.3c1). Did build as normal user and install as
    > root. MySQL server version that I'm using is 5.1.41, if that has
    > anything to do with the error. I then copied, libmysqlclient_r.so.16
    > library to /usr/lib/ folder and then I am able to import the module as
    > root user. But cannot do this as normal user.
    >
    > Now, while doing import MySQLdb as normal user, I get the following
    > error message. The scripts will be run as apache and hence cannot have
    > this error. Please check the following output. Also I have attached the
    > output while doing build and install process.
    >
    > [kurianmt@server MySQL-python-1.2.3c1]$ python
    > Python 2.4.3 (#1, Jan 21 2009, 01:10:13)
    > [GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2
    > Type "help", "copyright", "credits" or "license" for more information.>>> import MySQLdb
    >
    > /usr/lib/python2.4/site-packages/MySQL_python-1.2.3c1-py2.4-linux-i686.egg/_mysql.py:3: UserWarning: Module _mysql was already imported from /usr/lib/python2.4/site-packages/MySQL_python-1.2.3c1-py2.4-linux-i686.egg/_mysql.pyc, but /opt/downloads/py-modules/MySQL-python-1.2.3c1 is being added to sys.path
    >
    > It would be a great help if I understand what's going on!!! Thanks in
    > advance.
    >
    > Regards,
    >
    > Kurian Mathew Thayil.
    >
    >  MySQLdb-build.txt
    > 3KViewDownload
    >
    >  MySQLdb-Install.txt
    > 6KViewDownload
    >
    >  signature.asc
    > < 1KViewDownload


    The warning looks familiar. Are you running python from the MySQLdb
    source directory? ie. /opt/downloads/py-modules/MySQL-python-1.2.3c1

    I think you just need to change directories and the warning will go
    away. Check what's happening on line 3 of _mysql.py I don't have the
    source in front of me.

    ~Sean
     
    Sean DiZazzo, Mar 25, 2010
    #2
    1. Advertising

  3. -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.10 (GNU/Linux)

    iEYEABECAAYFAkuq22MACgkQmpp12uIyOU/nwQCdE1FsEo+POM9D2VKaODbToX36
    hHAAn17yKW05K4+DUTkC3wCozwcsVWCu
    =iYnG
    -----END PGP SIGNATURE-----
     
    Kurian Thayil, Mar 25, 2010
    #3
  4. Kurian Thayil

    Sean DiZazzo Guest


    > You are right. I was trying to import the module sitting on the source
    > folder :"-). Thanks for your quick response and let me try further.



    Sweet! I remember it because it confused the hell out of me on at
    least one past occasion. :)
     
    Sean DiZazzo, Mar 25, 2010
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Klaus Schneider
    Replies:
    1
    Views:
    582
    Rolf Magnus
    Dec 2, 2004
  2. Alan Little

    can't import MySQldb on OS X

    Alan Little, Jun 25, 2003, in forum: Python
    Replies:
    0
    Views:
    859
    Alan Little
    Jun 25, 2003
  3. Pierre Rouleau
    Replies:
    4
    Views:
    854
    Pierre Rouleau
    Mar 7, 2004
  4. Michael Boldin via alt email

    IDLE & MySQLdb import error

    Michael Boldin via alt email, Mar 4, 2007, in forum: Python
    Replies:
    0
    Views:
    591
    Michael Boldin via alt email
    Mar 4, 2007
  5. lander
    Replies:
    5
    Views:
    626
    bruce barker
    Mar 5, 2008
Loading...

Share This Page