0

I am attempting to use the PyArango driver for ArangoDB. I am using Python 3.5.2 for Windows (that is what is provided by my organization) and ArangoDB 3.0 running locally on my computer.

I run the following in the python interactive shell (or in a script):

from pyArango.connection import *
myConnection = Connection()

When the Connection() line is evaluated the following is output to the console:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pyArango\connection.py", line 88, in __init__
    self.reload()
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pyArango\connection.py", line 107, in reload
    data = r.json()
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\models.py", line 812, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python35-32\lib\json\__init__.py", line 319, in loads
    return _default_decoder.decode(s)
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python35-32\lib\json\decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python35-32\lib\json\decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

The online tutorial/Documentation at https://www.arangodb.com/tutorials/tutorial-python/ and https://github.com/tariqdaouda/pyArango indicates support for ArangoDB 3.x and Python 3.4. Has enyone else encountered this problem attempting to use Python 3.5 with the pyArango driver? If so is there a resolution to this issue?

Thanks

2
  • pyArango is automatically tested on both 2.7 and 3.5. I've just pushed an update for printing the request content whenever a call to json() fails. Could you do a git pull and retry? That should give us more infos about what is going on. Commented Jul 25, 2016 at 22:20
  • Thanks. I pulled the latest update. The problem is due to the proxy server rejecting the python http client's attempt to connect to the ArangoDB server. The proxy server returns an html error page which is not parsable by the json parser. Commented Jul 27, 2016 at 18:15

2 Answers 2

1

The problem was caused by the firewall/proxy blocking http requests from the python http client. The firewall/proxy returned an html error page which caused the json decode error when it was processed by the json parser used by pyArango. The maintainers of pyArango added a log output on json decode failure that made this error condition obvious. Attempting to access the arango server with a browser such as firefox was not blocked by the firewall/proxy.

Sign up to request clarification or add additional context in comments.

Comments

0

we have updated the tutorial - it was missing the authentification steps.

However, I've not been able to get your error message about the failed json parser; I get:

>>> myConnection = Connection()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/pyArango-1.1.0-py3.5.egg/pyArango/connection.py", line 88, in __init__
  File "/usr/local/lib/python3.5/dist-packages/pyArango-1.1.0-py3.5.egg/pyArango/connection.py", line 105, in reload
  File "/usr/local/lib/python3.5/dist-packages/pyArango-1.1.0-py3.5.egg/pyArango/connection.py", line 30, in __call__
pyArango.theExceptions.ConnectionError: Unauthorized access, you must supply a (username, password) with the correct credentials. URL: http://localhost:8529/_api/database/user, status: 401. Errors: b''

which is the expected error message.

1 Comment

I am running on Windows using python 3.5 and pyArango==1.2.3. I attempted to downgrade to version 1.1 to match the version of pyArango you are using but on Windows the module fails to load with the following error: >>> from pyArango.connection import * Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\xxxxx\Downloads\dist\pyArango-1.1.0\pyArango\connection.py", l ine 4, in <module> from database import Database, DBHandle ImportError: No module named 'database'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.