juanique / python-virtuoso

A (fast and dirty) virtuoso triplestore wrapper for python
9 stars 3 forks source link

ImportError: cannot import name Virtuoso #1

Open wudapeng268 opened 7 years ago

wudapeng268 commented 7 years ago

Hi juanique: I install this tool follow your README, but when I test from vituoso import Virtuoso I got INFO:rdflib:RDFLib Version: 5.0.0-dev Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: cannot import name Virtuoso Actually I don't know how to test python-virtuoso, maybe is the tests.py, when I input host=localhost, user=dba pwd=dba `..EEEE ERROR: test_execute_bad_script (main.CommandsTests) Executing bad scripts should raise a ISQLWrapperException Traceback (most recent call last): File "tests.py", line 44, in test_execute_bad_script "fixtures/bad_script.sql") File "/usr/lib/python2.7/unittest/case.py", line 475, in assertRaises callableObj(*args, **kwargs) File "/home/zhaocq/python-virtuoso-master/virtuoso/isqlwrapper.py", line 23, in execute_script stderr=subprocess.PIPE) File "/usr/lib/python2.7/subprocess.py", line 710, in init errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory

ERROR: test_execute_cmd (main.CommandsTests) It can execute a given command string. Traceback (most recent call last): File "tests.py", line 49, in test_execute_cmd result = self.isql.execute_cmd("status();") File "/home/zhaocq/python-virtuoso-master/virtuoso/isqlwrapper.py", line 39, in execute_cmd result = self.execute_script(tf_query.name) File "/home/zhaocq/python-virtuoso-master/virtuoso/isqlwrapper.py", line 23, in execute_script stderr=subprocess.PIPE) File "/usr/lib/python2.7/subprocess.py", line 710, in init errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory

ERROR: test_execute_script (main.CommandsTests) It can execute a given script

Traceback (most recent call last): File "tests.py", line 37, in test_execute_script result = self.isql.execute_script("fixtures/status.sql") File "/home/zhaocq/python-virtuoso-master/virtuoso/isqlwrapper.py", line 23, in execute_script stderr=subprocess.PIPE) File "/usr/lib/python2.7/subprocess.py", line 710, in init errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory

ERROR: test_semicolon (main.CommandsTests) Final semicolon is optional

Traceback (most recent call last): File "tests.py", line 55, in test_semicolon result = self.isql.execute_cmd("status()") File "/home/zhaocq/python-virtuoso-master/virtuoso/isqlwrapper.py", line 39, in execute_cmd result = self.execute_script(tf_query.name) File "/home/zhaocq/python-virtuoso-master/virtuoso/isqlwrapper.py", line 23, in execute_script stderr=subprocess.PIPE) File "/usr/lib/python2.7/subprocess.py", line 710, in init errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory

Ran 6 tests in 0.010s

FAILED (errors=4)` I also try to change default port as 1111 because my virtuoso starts at port 1111 default, It's also the same error. Can you help me solve this problem? I will appreciate it, thx.

juanique commented 7 years ago

Hi wudapeng268,

I literally haven't touched or run this code in 5 years. At some point I know it worked but in retrospective it does look like a really ugly hack and I don't think I'd recommend it to anyone.

I would recommend you take a look at other, supported libraries for connecting to virtuoso.

Perhaps any of the suggestions here? http://stackoverflow.com/questions/40774932/how-to-access-virtuoso-rdf-store-from-python

wudapeng268 commented 7 years ago

Hi juanique: Thanks for your reply. Actually I have read this suggestions, but can't solve it. I will look it again。

zhimeng9 commented 7 years ago

from vituoso.vituoso import Virtuoso

zhimeng9 commented 7 years ago

but when I try to do the query, the error throw: "TypeError: 'Endpoint' object is not callable"