Closed GoogleCodeExporter closed 8 years ago
Worth noting that this works fine with pyodbc
Original comment by cyborg10...@gmail.com
on 1 Apr 2013 at 9:05
Same result with latest from Git.
Original comment by cyborg10...@gmail.com
on 1 Apr 2013 at 10:25
Can you provide additional information, such as 64bit , 32bit information ?
Original comment by jiangwen...@gmail.com
on 1 Apr 2013 at 10:50
Yep, 64bit CentOS 6.1 with 64-bit Python 2.7.2.
Original comment by cyborg10...@gmail.com
on 1 Apr 2013 at 10:52
Also tried with 64-bit CentOS 6.3, RHEL 6.1 and Python 3.2.3. All give the
same error.
Original comment by cyborg10...@gmail.com
on 1 Apr 2013 at 11:21
[deleted comment]
Can you check what would be the output if you add ansi=False?
conn = pypyodbc.connect('DRIVER={MySQL ODBC 5.1
Driver};SERVER=myserver;DATABASE=mydb;UID=user;PWD=password',ansi=False,ansi=Fal
se,unicode_results=Fase)
Original comment by jiangwen...@gmail.com
on 1 Apr 2013 at 12:02
Do you mean ansi=True? False is default. If I do =True, it connects ok, but
then all my results come back encoded like:
u'\udc80\udc75\udc40\udc65'
Original comment by cyborg10...@gmail.com
on 1 Apr 2013 at 12:02
conn = pypyodbc.connect('DRIVER={MySQL ODBC 5.1
Driver};SERVER=myserver;DATABASE=mydb;UID=user;PWD=password',ansi=False,unicode_
results=False)
Gives me the same error...
conn = pypyodbc.connect('DRIVER={MySQL ODBC 5.1
Driver};SERVER=myserver;DATABASE=mydb;UID=user;PWD=password',ansi=True,unicode_r
esults=False)
Still gives me unicode results.
Original comment by cyborg10...@gmail.com
on 1 Apr 2013 at 12:05
[deleted comment]
And if you try and print one of the unicode results:
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 0-3:
ordinal not in range(256)
Original comment by cyborg10...@gmail.com
on 1 Apr 2013 at 12:39
I will install a CentOS 64bit and try that.
Original comment by jiangwen...@gmail.com
on 1 Apr 2013 at 12:59
Thanks! Just so you get the same setup:
$ odbcinst --version
unixODBC 2.3.0
$ cat /etc/odbcinst.ini
[PostgreSQL]
Description=ODBC for PostgreSQL
Driver=/usr/lib/libodbcpsql.so
FileUsage=1
[SQL Server Native Client 11.0]
Description=Microsoft SQL Server ODBC Driver V1.0 for Linux
Driver=/opt/microsoft/sqlncli/lib64/libsqlncli-11.0.so.1790.0
Threading=1
UsageCount=1
[MySQL ODBC 5.1 Driver]
Driver=/usr/lib64/libmyodbc5.so
UsageCount=2
Original comment by cyborg10...@gmail.com
on 1 Apr 2013 at 1:57
It works fine on my Ubuntu box at home, so might well be a CentOS / RHEL issue.
Original comment by cyborg10...@gmail.com
on 1 Apr 2013 at 8:10
is your ubuntu at home 64 bit?
Original comment by jiangwen...@gmail.com
on 1 Apr 2013 at 11:18
Yes
Original comment by cyborg10...@gmail.com
on 2 Apr 2013 at 6:21
Hi, Finally I'm not able to setup CentOS, so I would like to suggest two quick
changes you can have a try.
First step:
-Open pypyodbc.py, text replace "if status == 0 and 'SQL_WCHART_CONVERT' in
output:" to "if True:" .This will only make one change in Line 479.
Have a try.
Second step:
-If that doesn't work, text replace all "utf_16" to "utf_32" and all
"utf_16_le" to "utf_32"
And then try again.
Hope that works.
Original comment by jiangwen...@gmail.com
on 2 Apr 2013 at 12:10
The fist test results in:
>>> import pypyodbc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/scratch/Python/lib/python2.7/site-packages/pypyodbc.py", line 518, in <module>
raise OdbcLibraryError('Using narrow Python build with ODBC library '
pypyodbc.OdbcLibraryError: 'Using narrow Python build with ODBC library
expecting wide unicode is not supported.'
And the second (with or without the first) results in the same issue as before.
Original comment by cyborg10...@gmail.com
on 2 Apr 2013 at 12:59
This works fine on the same box with 3.3.1, so it could be an issue with 2.7.2.
Original comment by cyborg10...@gmail.com
on 15 May 2013 at 1:18
2.7.4 has the same issue
Original comment by cyborg10...@gmail.com
on 15 May 2013 at 1:39
Original comment by jiangwen...@gmail.com
on 3 Sep 2013 at 11:35
Original issue reported on code.google.com by
cyborg10...@gmail.com
on 1 Apr 2013 at 9:03Attachments: