Now PIP repository is updated. Regards :)
Il giorno domenica 30 novembre 2014 09:31:28 UTC+1, Neeraj Sharma ha scritto: > > Hi Ostico, > > I faced a similar issue today and it worked when I changed my > defaultEncoding to utf-8 and omitted the encode function from the code. But > later I observed PyOrient latest version has all the right changes in it. > > I think the pip repository is not updated. It would be great if it can be > updated. > > Thanks for a great tool to work with. It makes working with Orient a > charm. > > Thanks, > Neeraj > > On Saturday, November 29, 2014 5:41:15 AM UTC-8, Ostico wrote: >> >> Hi LIU, >> >> i think you have an old version of driver, i run these tests and it works >> fine. Maybe the PIP repository is not updated. >> I suggest you to update your driver to the last version from >> https://github.com/mogui/pyorient >> >> def test_sql_batch_2(self): >> >> cluster_id = self.client.command("create class fb extends V") >> cluster_id = self.client.command("create class response extends V") >> cluster_id = self.client.command("create class followed_by extends E") >> >> cluster_id = self.client.batch( ( >> "begin;" >> "let a = create vertex fb set name = 'd1';" >> "let b = create vertex response set name = 'a1';" >> "create edge followed_by from $a to $b;" >> "commit;" >> ) ) >> >> def test_sql_batch_3(self): >> >> cluster_id = self.client.command("create class fb extends V") >> cluster_id = self.client.command("create class response extends V") >> cluster_id = self.client.command("create class followed_by extends E") >> >> cmd = ( >> "begin;" >> "let a = create vertex fb set name = 'd1';" >> "let c = select from fb limit 1;" >> "let d = select from response limit 1;" >> "let e = create edge from $c to $d;" >> "commit;" >> ) >> >> cluster_id = self.client.batch(cmd) >> >> >> >> Il giorno sabato 29 novembre 2014 09:38:26 UTC+1, Xiaobing LIU ha scritto: >>> >>> Hi all, >>> When I use batch() function of pyorient, I encounter a very strange >>> problem. >>> I did it following such steps: >>> >>> *1. create and open db using pyorient;* >>> *2. create class and edge; * >>> *3. using batch() function for test* >>> >>> core codes is like this: >>> *cluster_id = client.command("create class fb extends V")* >>> *cluster_id = client.command("create class response extends V")* >>> *cluster_id = client.command("create class followed_by extends E")* >>> *cluster_id = client.batch("begin;create vertex fb set name = >>> 'd1';create vertex response set name = 'a1';create edge followed_by from fb >>> to response;commit;")* >>> >>> the last line of the code will report such an error: >>> * File "loaddata_to_orientdb.py", line 62, in <module>* >>> * cluster_id = client.batch("begin;create vertex fb set name = >>> 'd1';create vertex response set name = 'a1';create edge followed_by from fb >>> to response;commit;")* >>> * File >>> "/root/workplace/orientdb/env/lib/python2.7/site-packages/pyorient/orient.py", >>> >>> line 208, in batch* >>> * .prepare(( QUERY_SCRIPT, ) + args).send().fetch_response()* >>> * File >>> "/root/workplace/orientdb/env/lib/python2.7/site-packages/pyorient/utils.py", >>> >>> line 47, in wrap_function* >>> * return wrap(*args, **kwargs)* >>> * File >>> "/root/workplace/orientdb/env/lib/python2.7/site-packages/pyorient/utils.py", >>> >>> line 60, in wrap_function* >>> * return wrap(*args, **kwargs)* >>> * File >>> "/root/workplace/orientdb/env/lib/python2.7/site-packages/pyorient/messages/commands.py", >>> >>> line 131, in prepare* >>> * return super( CommandMessage, self ).prepare()* >>> * File >>> "/root/workplace/orientdb/env/lib/python2.7/site-packages/pyorient/messages/base.py", >>> >>> line 72, in prepare* >>> * self._encode_field( x ) for x in self._fields_definition* >>> * File >>> "/root/workplace/orientdb/env/lib/python2.7/site-packages/pyorient/messages/base.py", >>> >>> line 72, in <genexpr>* >>> * self._encode_field( x ) for x in self._fields_definition* >>> * File >>> "/root/workplace/orientdb/env/lib/python2.7/site-packages/pyorient/messages/base.py", >>> >>> line 200, in _encode_field* >>> * buf = v.encode('utf-8')* >>> *UnicodeDecodeError: 'utf8' codec can't decode byte 0x81 in position 77: >>> invalid start byte* >>> >>> It sounds like the utf8 code problem, but I have already added such >>> lines in the start of my program: >>> *# -*- coding: utf-8 -*-* >>> *import sys* >>> *import pyorient* >>> *reload(sys)* >>> *sys.setdefaultencoding('utf-8')* >>> >>> The more strange is that when i use the clause >>> *cluster_id = client.batch("begin;create vertex fb set name = >>> 'd1';create vertex response set name = 'a1';commit;")* >>> instead of >>> *cluster_id = client.batch("begin;create vertex fb set name = >>> 'd1';create vertex response set name = 'a1';create edge followed_by from fb >>> to response;commit;")* >>> Then the error disappeared and the records were created successfully. Is >>> this an bug of pyorient? >>> >>> The following codes exist the same problem: >>> *cmd = "begin;" + \* >>> * "let a = create vertex fb set name = 'd1';" + \* >>> * "let c = select from fb limit 1;" + \* >>> * "let d = select from response limit 1;" + \* >>> * "let e = create edge from $c to $d;" + \* >>> * "commit;"* >>> *cluster_id = client.batch(cmd)* >>> >>> If I delete this line:* "let a = create vertex fb set name = >>> 'd1';" + \* , it works well. >>> >>> Could anybody give me a hand, thanks in advance! >>> >>> The release information: >>> orientdb-community-1.7.10 >>> pyorient-1.1.1 >>> CentOS6.5 >>> Oracle java version "1.7.0_71" >>> >>> Regards! >>> >> -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
