orientechnologies / pyorient

OrientDB driver for Python that uses the binary protocol.
Apache License 2.0
119 stars 38 forks source link

Can't connect in a database in OrientDB 2.2 #17

Closed aemitos closed 8 years ago

aemitos commented 8 years ago

I did try doing:

$ docker run -d -i -t --name orientdb -p 2525:2424 -p 2580:2480 -e ORIENTDB_ROOT_PASSWORD=password orientdb:2.2.0

Then:

$ docker exec -i -t orientdb /orientdb/bin/console.sh

OrientDB console v.2.2.0 (build develop@r79d281140b01c0bc3b566a46a64f1573cb359783; 2016-05-18 14:14:32+0000) www.orientdb.com
Type 'help' to display all the supported commands.
Installing extensions for GREMLIN language v.2.6.0

orientdb> connect remote:192.168.30.1:2525 root password
orientdb {server=remote:192.168.30.1:2525/}> create database remote:192.168.30.1:2525/dbtest root password plocal       

Creating database [remote:192.168.30.1:2525/dbtest] using the storage type [plocal]...
Disconnecting from remote server [remote:192.168.30.1:2525/]...
OK
Connecting to database [remote:192.168.30.1:2525/dbtest] with user 'admin'...OK
Database created successfully.

Current database is: remote:192.168.30.1:2525/dbtest
orientdb {db=dbtest}> connect remote:192.168.30.1:2525/dbtest admin admin

Disconnecting from the database [dbtest]...OK
Connecting to database [remote:192.168.30.1:2525/dbtest] with user 'admin'...OK
orientdb {db=dbtest}> 

Then I test in python with:

$ virtualenv --python=python2.7 odb-venv && source odb-venv/bin/activate && pip install pip setuptools --upgrade && pip install pyorient urllib3
(odb-venv) $ python
>>> import pyorient
>>> client = pyorient.OrientDB('192.168.30.1', 2525)
>>> client.connect('root','password')
12
>>> print(client.db_list())
{{'databases': {'dbtest': 'plocal:/orientdb/databases/dbtest'}}}
>>> client.db_open('dbtest','admin','admin')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/andre/odb-venv/lib/python2.7/site-packages/pyorient/orient.py", line 379, in db_open
    .prepare((db_name, user, password, db_type, client_id)).send().fetch_response()
  File "/home/andre/odb-venv/lib/python2.7/site-packages/pyorient/messages/database.py", line 141, in fetch_response
    info = OrientVersion(release)
  File "/home/andre/odb-venv/lib/python2.7/site-packages/pyorient/otypes.py", line 202, in __init__
    self._parse_version(release)
  File "/home/andre/odb-venv/lib/python2.7/site-packages/pyorient/otypes.py", line 235, in _parse_version
    self.build = int( self.build )
ValueError: invalid literal for int() with base 10: '0 (build develop@r79d281140b01c0bc3b566a46a64f1573cb359783; 2016'

The same code above works fine with 2.1 Any help?

Ostico commented 8 years ago

This is a known bug, already reported here: https://github.com/mogui/pyorient/issues/195 . i will fix as soon as possible. As workaround you can comment the line as @kaYcee suggests:

https://github.com/mogui/pyorient/issues/185#issuecomment-223883399