python - Using py2neo v3 with google app engine -


i'm trying set backend using py2neo on google app engine. works fine when pushed on dev on app engine, however, unfortunately, doesn't work when use on localhost.

first, i've setted home environment variable in python (thanks tip, code works on dev) doesn't fix localhost problem

then, i've followed advice "importerror: no module named _ssl" dev_appserver.py google app engine prevents 1 exception rises after.

here traceback

    ft1.1: traceback (most recent call last):   file "/users/arnaud/documents/project/app/test/neo4j/test_graph_handler.py", line 13, in test_get_direct_neighbours     selection = self.graph_handler.get_direct_neighbours("8")   file "/users/arnaud/documents/project/app/neo4j/graph_handler.py", line 20, in get_direct_neighbours     labels(l) `relationship`" % self.protect(ean))   file "/users/arnaud/documents/project/app/libs/py2neo/database/__init__.py", line 694, in run     return self.begin(autocommit=true).run(statement, parameters, **kwparameters)   file "/users/arnaud/documents/project/app/libs/py2neo/database/__init__.py", line 370, in begin     return self.transaction_class(self, autocommit)   file "/users/arnaud/documents/project/app/libs/py2neo/database/__init__.py", line 1212, in __init__     self.session = driver.session()   file "/users/arnaud/documents/project/app/libs/py2neo/packages/neo4j/v1/session.py", line 126, in session     connection = connect(self.address, self.ssl_context, **self.config)   file "/users/arnaud/documents/project/app/libs/py2neo/packages/neo4j/v1/bolt.py", line 444, in connect     if not store.match_or_trust(host, der_encoded_server_certificate):   file "/users/arnaud/documents/project/app/libs/py2neo/packages/neo4j/v1/bolt.py", line 397, in match_or_trust     f_out = os_open(self.path, o_creat | o_append | o_wronly, 0o600)  # todo: windows   file "/applications/googleappenginelauncher.app/contents/resources/googleappengine-default.bundle/contents/resources/google_appengine/google/appengine/tools/devappserver2/python/stubs.py", line 73, in fake_open     raise oserror(errno.erofs, 'read-only file system', filename) oserror: [errno 30] read-only file system: '/users/arnaud/.neo4j/known_hosts' 

as lauches in sandboxed environnement , fake user, exception normal not happen on dev.

and here /users/arnaud/documents/project/app/neo4j/graph_handler.py:20

 13     def get_direct_neighbours(self, ean):  14         selection = self.graph.run("\  15                 match\  16                 (:product {ean: '%s'})-->(l)<--(n:product)\  17                 return\  18                 n.ean `ean`,\  19                 n.name `name`,\  20                 labels(l) `relationship`" % self.protect(ean))  21         return selection 

so understand why work on dev, tried localize sandbox , dev execution start being different. , right here in /users/arnaud/documents/project/app/libs/py2neo/packages/neo4j/v1/bolt.py:427

427     if ssl_context , ssl_available: 428         host, port = host_port 429         if __debug__: log_info("~~ [secure] %s", host) 430         try: 431             s = ssl_context.wrap_socket(s, server_hostname=host if has_sni else none) 432         except sslerror cause: 433             error = protocolerror("cannot establish secure connection; %s" % cause.args[1]) 434             error.__cause__ = cause 435             raise error 436         else: 437             # check server provides certificate 438             der_encoded_server_certificate = s.getpeercert(binary_form=true) 439             if der_encoded_server_certificate none: 440                 raise protocolerror("when using secure socket, server should provide certificate") 441             trust = config.get("trust", trust_default) 442             if trust == trust_on_first_use: 443                 store = personalcertificatestore() 444                 if not store.match_or_trust(host, der_encoded_server_certificate): 445                     raise protocolerror("server certificate not match known certificate %r; check " 446                                         "details in file %r" % (host, known_hosts)) 447     else: 448         der_encoded_server_certificate = none 

because in dev, ssl loading fails in ssl_compat.py while on localhost, succeeds , code goes inside if statement , fails @ line 444

to understand forced ssl_available falsy, have wierd problems app engine sockets not recognized sockets

ft1.1: traceback (most recent call last):   file "/users/arnaud/documents/project/app/test/neo4j/test_graph_handler.py", line 13, in test_get_direct_neighbours     selection = self.graph_handler.get_direct_neighbours("8")   file "/users/arnaud/documents/project/app/neo4j/graph_handler.py", line 20, in get_direct_neighbours     labels(l) `relationship`" % self.protect(ean))   file "/users/arnaud/documents/project/app/libs/py2neo/database/__init__.py", line 694, in run     return self.begin(autocommit=true).run(statement, parameters, **kwparameters)   file "/users/arnaud/documents/project/app/libs/py2neo/database/__init__.py", line 370, in begin     return self.transaction_class(self, autocommit)   file "/users/arnaud/documents/project/app/libs/py2neo/database/__init__.py", line 1212, in __init__     self.session = driver.session()   file "/users/arnaud/documents/project/app/libs/py2neo/packages/neo4j/v1/session.py", line 126, in session     connection = connect(self.address, self.ssl_context, **self.config)   file "/users/arnaud/documents/project/app/libs/py2neo/packages/neo4j/v1/bolt.py", line 460, in connect     ready_to_read, _, _ = select((s,), (), (), 0)   file "/applications/googleappenginelauncher.app/contents/resources/googleappengine-default.bundle/contents/resources/google_appengine/google/appengine/api/remote_socket/_remote_socket.py", line 483, in select     _setstate(request, _getsocket(value), pollin)   file "/applications/googleappenginelauncher.app/contents/resources/googleappengine-default.bundle/contents/resources/google_appengine/google/appengine/api/remote_socket/_remote_socket.py", line 425, in _getsocket     raise valueerror('select supported on socket objects.') valueerror: select supported on socket objects. 

if have faced same issues, interested in because having push on dev before test quite painful.

edit: want know, have no answer nigel yet , needed fast solution, i've created own class send , recieve cypher requests, it's compatible app engine , i've putted on gist: https://gist.github.com/arnaudparan/e26f291ba8b3c08e5b762d549667c7d6 it's experimental , might not work if ask full nodes if can help, publish it

the 1st traceback indicate py2neo package may incompatible gae's sandbox restrictions. in particular shows attempt open /users/arnaud/.neo4j/known_hosts file in write mode (os_open(self.path, o_creat | o_append | o_wronly, 0o600)) not allowed. check if it's somehow possible configure py2neo not that.

the sandbox has restrictions on sockets, see limitations , restrictions.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -