virtuoso-python
virtuoso-python copied to clipboard
UnicodeDecodeError: 'utf32' codec can't decode bytes
I just made a fresh install of Virtuoso via docker (https://hub.docker.com/r/joernhees/virtuoso/, latest build), and a fresh install of virtuoso-python
from github with the latest version.
When I try to run the test for rdflib, but get the following error on all tests:
Traceback (most recent call last):
File "/root/virt-env/virtuoso-python/virtuoso/tests/test_rdflib3.py", line 56, in test_open
store = Virtuoso(rdflib_connection)
File "/root/virt-env/virtuoso-python/virtuoso/vstore.py", line 225, in __init__
super(Virtuoso, self).__init__(*av, **kw)
File "/root/virt-env/local/lib/python2.7/site-packages/rdflib/store.py", line 142, in __init__
self.open(configuration)
File "/root/virt-env/virtuoso-python/virtuoso/vstore.py", line 246, in open
establish = self.connection # ensures connection is established
File "/root/virt-env/virtuoso-python/virtuoso/vstore.py", line 265, in connection
self.initialize_connection()
File "/root/virt-env/virtuoso-python/virtuoso/vstore.py", line 242, in initialize_connection
self.__init_ns_decls__()
File "/root/virt-env/virtuoso-python/virtuoso/vstore.py", line 254, in __init_ns_decls__
for prefix, namespace in c.execute(q):
UnicodeDecodeError: 'utf32' codec can't decode bytes in position 0-3: codepoint not in range(0x110000)
This seems related to how ODBC is configured, but I was not able to fix this :-(
Note also that the connexion string says: DSN=VOS;UID=dba;PWD=dba;WideAsUTF16=Y
,
not sure of the WideAsUTF16
options is relevant here...
Hmmm... not sure, and not available to look at the moment. First hunch, fwiw: is the definition of wchar the same width on the python platform as on the docker image?
I confirm that the current configuration works on my laptop, but not on the server on which I encountered the problem (same docker image, but different versions of python2...).
Through trials and errors, I found a solution that works in both situations (branch fix_issue_14
). I find it a little weird that it does not break a configuration that worked with the old values, but again, ODBC is black magic to me... :-/
Very interesting, it would confirm my hunch. Kudos on finding the fix, it will help me. I'll try to come up with something better in a few weeks, when my current rush is over.
Hi there, thank you very much for putting some effort to maintain this:
I'm getting the exact same error:
2018-07-13 07:32:11,143:ERROR:flask_appbuilder.security.sqla.manager:DB Creation and initialization failed: 'utf32' codec can't decode bytes in position 0-3: code point not in range(0x110000)
Even when using fix_issue_14
branch. I am, however using SQLALCHEMY. Could this require further changes?
same here! I am trying to use this package to bridge superset and virtuoso?
ERROR: {"error": "Connection failed!\n\nThe error message returned was:\n'utf32' codec can't decode bytes in position 0-3: codepoint not in range(0x110000)"}
@mohadelrezk I gave up and move to rdashboards.
@vromero it stopped shwoing that error now it giving that one:
ERROR: {"error": "Connection failed!\n\nThe error message returned was:\n(pyodbc.Error) ('HY000', 'The driver did not supply an error!') (Background on this error at: http://sqlalche.me/e/dbapi)"}
I am using this branch https://github.com/maparent/virtuoso-python/tree/pyodbc4 and this odbc.ini config:
[VOS] Description = Open Virtuoso Driver = /usr/local/virtuoso-opensource/lib/virtodbcu_r.so Address = localhost:1111 Locale = en.UTF-8
you will notice that there is multiple odbc.ini out there!
Same here, error
File "D:\Python37\lib\site-packages\virtuoso-0.12.6-py3.7.egg\virtuoso\vstore.py", line 254, in __init_ns_decls__ for prefix, namespace in c.execute(q): File "D:\Python37\lib\encodings\utf_32_le.py", line 11, in decode return codecs.utf_32_le_decode(input, errors, True) UnicodeDecodeError: 'utf-32-le' codec can't decode bytes in position 0-3: code point not in range(0x110000)
For the record, I've migrated my app to Python3, and given up on Virtuoso :-/
The error shown in my previous post is related to the version you mentioned.