/usr/lib/python2.3/site-packages/_mysql.so: undefined symbol

2005-09-15 Thread francescomoi
Hello.

Python 2.3.4 (#1, Feb  2 2005, 12:11:53)
[GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2
MySQL-python-1.2.0

I'm trying to execute this script:
--
#!/usr/bin/python
import MySQLdb
conn = MySQLdb.connect (host = "localhost", user = "root", passwd =
"", db = "test")
cursor = conn.cursor ()
cursor.execute ("SELECT VERSION()")
row = cursor.fetchone ()
print "server version:", row0
cursor.close ()
conn.close ()
--

But I get this error message:

[ ]# python test.py
Traceback (most recent call last):
  File "test.py", line 2, in ?
import MySQLdb
  File "/usr/lib/python2.3/site-packages/MySQLdb/__init__.py", line 27,
in ?
import _mysql
ImportError: /usr/lib/python2.3/site-packages/_mysql.so: undefined
symbol: mysql_rollback


What am I doing wrong?

-- 
http://mail.python.org/mailman/listinfo/python-list


"mysql.h: No such file or directory" when building MySQL-python

2005-04-27 Thread francescomoi
Hi.

I'm trying to build 'MySQL-python-1.2.0' on my Linux FC2:
--
[ ]# export PATH=$PATH:/usr/local/mysql/bin/
[ ]# export mysqlclient=mysqlclient_r
[ ]# python setup.py clean
[ ]# python setup.py build
running build
running build_py
running build_ext
building '_mysql' extension
creating build/temp.linux-i686-2.3
gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -march=i386
-mcpu=i686 -D_GNU_SOURCE -fPIC -fPIC -I/usr/include/python2.3 -c
_mysql.c -o build/temp.linux-i686-2.3/_mysql.o -I'/usr/include/mysql'
_mysql.c:41:19: mysql.h: No such file or directory


I don't understand why I get this error message, since I usually build
MySQL+C programs
by using:
gcc -o myprogram -I'/usr/local/mysql/include/mysql'
-L'/usr/local/mysql/lib/mysql' -lmysqlclient -lz -lcrypt -lnsl -lm
myprogram.c

My server configuration:
---
[ ]# /usr/local/mysql/bin/mysql_config
--cflags[-I'/usr/local/mysql/include/mysql']
--libs  [-L'/usr/local/mysql/lib/mysql' -lmysqlclient
-lz -lcrypt -lnsl -lm]
--socket[/tmp/mysql.sock]
--port  [3306]
--version   [3.23.58]

[ ]# find . -name "mysql.h"
./usr/src/php-4.3.10/ext/mysql/libmysql/mysql.h
./usr/src/mysql-3.23.58/include/mysql.h
./usr/src/mysql-4.1.9/include/mysql.h
./usr/include/mysql/mysql.h
./usr/local/mysql/include/mysql/mysql.h
--
[ ]# locate libmysqlclient
/usr/src/mysql-3.23.58/libmysql/.libs/libmysqlclient.so
/usr/src/mysql-3.23.58/libmysql/.libs/libmysqlclient.a
/usr/src/mysql-3.23.58/libmysql/.libs/libmysqlclient.so.10
/usr/src/mysql-3.23.58/libmysql/.libs/libmysqlclient.so.10.0.0
/usr/src/mysql-3.23.58/libmysql/.libs/libmysqlclient.lai
/usr/src/mysql-3.23.58/libmysql/.libs/libmysqlclient.la
/usr/src/mysql-3.23.58/libmysql/libmysqlclient.la
/usr/src/mysql-4.1.9/libmysql/.libs/libmysqlclient.so
/usr/src/mysql-4.1.9/libmysql/.libs/libmysqlclient.a
/usr/src/mysql-4.1.9/libmysql/.libs/libmysqlclient.so.14
/usr/src/mysql-4.1.9/libmysql/.libs/libmysqlclient.lai
/usr/src/mysql-4.1.9/libmysql/.libs/libmysqlclient.so.14.0.0
/usr/src/mysql-4.1.9/libmysql/.libs/libmysqlclient.la
/usr/src/mysql-4.1.9/libmysql/libmysqlclient.la
/usr/local/mysql/lib/mysql/libmysqlclient.la
/usr/local/mysql/lib/mysql/libmysqlclient.so.10.0.0
/usr/local/mysql/lib/mysql/libmysqlclient.so
/usr/local/mysql/lib/mysql/libmysqlclient.a
/usr/local/mysql/lib/mysql/libmysqlclient.so.10
--

Any suggestion? Thank you very much.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "mysql.h: No such file or directory" when building MySQL-python

2005-05-11 Thread francescomoi
Thank you Andy for your answer.

I tried by using '1.2.1c1' and '1.2.1c2', but with no success:
---
creating build/temp.linux-i686-2.3
gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -march=i386
-mcpu=i686 - D_GNU_SOURCE -fPIC -fPIC -I/usr/include/python2.3 -c
_mysql.c -o build/temp.linu x-i686-2.3/_mysql.o -I'/usr/include/mysql'
_mysql.c:41:19: mysql.h: No such file or directory


Finally I decided to copy '/usr/include/mysql/*.*' to my work
directory,
and I managed to build it. But when trying to execute a simple test,
I get this error message:
-
Traceback (most recent call last):
  File "./db.py", line 7, in ?
db = "test")
  File "/usr/lib/python2.3/site-packages/MySQLdb/__init__.py", line 66,
in Connect
return Connection(*args, **kwargs)
  File "/usr/lib/python2.3/site-packages/MySQLdb/connections.py", line
134, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2002, "Can't connect to local
MySQL server through socket '/var/lib/mysql/mysql.sock' (2)")
---

Any suggestion?. Regards


Andy Dustman wrote:
> [EMAIL PROTECTED] wrote:
>
> > I'm trying to build 'MySQL-python-1.2.0' on my Linux FC2:
> ...
> > gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -march=i386
> > -mcpu=i686 -D_GNU_SOURCE -fPIC -fPIC -I/usr/include/python2.3 -c
> > _mysql.c -o build/temp.linux-i686-2.3/_mysql.o
-I'/usr/include/mysql'
> > _mysql.c:41:19: mysql.h: No such file or directory
> ...
> > My server configuration:
> > ---
> > [ ]# /usr/local/mysql/bin/mysql_config
> > --cflags[-I'/usr/local/mysql/include/mysql']
> > --libs  [-L'/usr/local/mysql/lib/mysql'
-lmysqlclient
> > -lz -lcrypt -lnsl -lm]
> > --socket[/tmp/mysql.sock]
> > --port  [3306]
> > --version   [3.23.58]
> ...
> > Any suggestion? Thank you very much.
>
> Fedora's mysql_config puts quotes around the directory names, which
> confuses things. Try MySQL-python-1.2.1c1. I don't think this
entirely
> solves the problem, but I think I know how to fix it for 1.2.1c2. But
> try it and report your results here:
>
>
https://sourceforge.net/tracker/index.php?func=detail&aid=1146226&group_id=22307&atid=374932

-- 
http://mail.python.org/mailman/listinfo/python-list


"/usr/bin/ld: cannot find -lmysqlclient" when building MySQL-Python

2005-05-11 Thread francescomoi
Hi. I'm trying to build MySQL-python-1.2.0 on my Linux FC2
(with MySQL 3.23.58).

But when building, I get this error message:
---
[]# python setup.py build
running build
running build_py
running build_ext
building '_mysql' extension
creating build/temp.linux-i686-2.3
gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -march=i386
-mcpu=i686 -D_GNU_SOURCE -fPIC -fPIC -I/usr/include/python2.3 -c
_mysql.c -o build/temp.linux-i686-2.3/_mysql.o -I'/usr/include/mysql'
gcc -pthread -shared build/temp.linux-i686-2.3/_mysql.o
-L'/usr/lib/mysql' -lmysqlclient -lz -lcrypt -lnsl -lm -lmysqlclient -o
build/lib.linux-i686-2.3/_mysql.so
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
--

I've got that library installed:
--
[]# locate libmysqlclient
/usr/lib/mysql/libmysqlclient.so
/usr/lib/mysql/libmysqlclient_r.so
/usr/lib/mysql/libmysqlclient.a
/usr/lib/mysql/libmysqlclient.so.10
/usr/lib/mysql/libmysqlclient.so.10.0.0
/usr/lib/mysql/libmysqlclient_r.a
/usr/lib/mysql/libmysqlclient_r.so.10.0.0
/usr/lib/mysql/libmysqlclient_r.so.10
-
[]# vi /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/X11R6/lib
/usr/lib/qt-3.3/lib
/usr/local/mysql/lib/mysql
/usr/lib/mysql
--

What's happening? Thank you very much.

-- 
http://mail.python.org/mailman/listinfo/python-list


MySQL: 'latin-1' codec can't encode character

2005-05-13 Thread francescomoi
Hi.

I'm trying to store a text within a MySQL field (v 3.23.58) by using
MySQLdb
(v 1.2.1c3).

The text is: "telephone..." (note the last character)

And I get this error message:
---
File "/usr/lib/python2.3/site-packages/MySQLdb/connections.py", line
33, in defaulterrorhandler
raise errorclass, errorvalue
UnicodeEncodeError: 'latin-1' codec can't encode character u'\u2026' in
position 288: ordinal not in range(256)
---

Position 288 is the character I've mentioned. I suppose I must encode
this caracter
into a right one which MySQL could store, but I have no idea about how
to perform
it. Any suggestion?

Thank you very much.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MySQL: 'latin-1' codec can't encode character

2005-05-13 Thread francescomoi
Hi Fredrik.

Thank you very much for your quick answer.

Do you suggest to change it by using regexp or must I encode the whole
texto into a suitable one?

Regards.

Fredrik Lundh wrote:
> "[EMAIL PROTECTED]"
>
> > I'm trying to store a text within a MySQL field (v 3.23.58) by
using
> > MySQLdb
> > (v 1.2.1c3).
> >
> > The text is: "telephone..." (note the last character)
> >
> > And I get this error message:
> > ---
> > File "/usr/lib/python2.3/site-packages/MySQLdb/connections.py",
line
> > 33, in defaulterrorhandler
> > raise errorclass, errorvalue
> > UnicodeEncodeError: 'latin-1' codec can't encode character
u'\u2026' in
> > position 288: ordinal not in range(256)
> > ---
> >
> > Position 288 is the character I've mentioned. I suppose I must
encode
> > this caracter
> > into a right one which MySQL could store, but I have no idea about
how
> > to perform
> > it. Any suggestion?
>
> the character \u2026 is not part of the ISO-8859-1 character set.  if
you
> insist on storing that in 8-bit string, you have to find an 8-bit
encoding
> that includes that character (UTF-8 is one such alternative).
>
> if MySQL is set to store ISO-8859-1 only, you can replace the
character
> with it with three periods, drop it (use the "ignore" encoding
option) or
> replace it with a suitable marker (use the "replace" encoding
option).
> 
> 

-- 
http://mail.python.org/mailman/listinfo/python-list