Is there an official/stable/widely used API for python 2.7.
The docs (http://tinkerpop.apache.org) list a handful of mostly abandoned python implementation.
gremlinrestclient seems to be just a simple HTTP wrapper, with yet-another custom (non-standard) API.
The official docs (http://tinkerpop.apache.org/docs/3.2.1-SNAPSHOT/tutorials/gremlin-language-variants) suggest generating a python API, but the script under the "Using Python and GremlinServer" section generates an error:
javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: GraphTraversalSource for class: Script1
Seems quite odd to include a complicated -- easy to be out of date -- script in docs?; rather than, say, a source file with tests?
The official docs (http://tinkerpop.apache.org/docs/3.2.1-SNAPSHOT/tutorials/gremlin-language-variants) suggest generating a python API, but the script under the "Using Python and GremlinServer" section generates an error:
javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: GraphTraversalSource for class: Script1
Seems quite odd to include a complicated -- easy to be out of date -- script in docs?; rather than, say, a source file with tests?
pythonClass = new StringBuilder() pythonClass.append("from tornado import gen\n") pythonClass.append("from tornado.ioloop import IOLoop\n") pythonClass.append("from gremlinclient.tornado_client import submit\n")
return self.range(indices,indices+1)
--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/1b5ee3fd-d34c-482d-b1ef-32339ed3d879%40googlegroups.com.
1). Just to be clear, I'm referring to the Groovy source starting with:
What do you mean "import" other than what is in the code above? I.e., copying the entire source block into a file and submitting this to the Gremlin console causes the error above.
2). The generated python code (in the tutorial), linked here: http://tinkerpop.apache.org/docs/3.2.1-SNAPSHOT/resources/gremlin-python.pyhas errors; e.g., this following line fails:return self.range(indices,indices+1)trivial to fix (I assume "indeces" == "index", but has this been tested? Is it used by anyone?
/tmp$ pythonPython 2.7.2 (default, Oct 11 2012, 20:14:37)[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwinType "help", "copyright", "credits" or "license" for more information.>>> execfile("/tmp/gremlin-python.py")>>> g = PythonGraphTraversalSource("ws://localhost:8182/", "g")>>> g.V().range(0,1)g.V().range(0, 1)>>> g.V().limit(2)g.V().limit(2)>>>
3). gremlin-python.py isn't a valid python filename (for the sake of imports). This is trivial to fix, but again, makes me think it hasn't been tested.
4). Why put source code in the tutorial's text (i.e., if it's useful/intended to be used, why not put it in the the source distribution, or upload to PyPl?); perhaps I missed this? As I mentioned, the python libs listed here (http://tinkerpop.apache.org/docs/3.2.1-SNAPSHOT/tutorials/gremlin-language-variants) don't seem to have much traction. Would it be useful for me to create another python lib and have this listed?
Again, thanks very much for your help.
On Sunday, May 29, 2016 at 5:47:18 PM UTC-4, Marko A. Rodriguez wrote:Hello,The official docs (http://tinkerpop.apache.org/docs/3.2.1-SNAPSHOT/tutorials/gremlin-language-variants) suggest generating a python API, but the script under the "Using Python and GremlinServer" section generates an error:
javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: GraphTraversalSource for class: Script1
Seems quite odd to include a complicated -- easy to be out of date -- script in docs?; rather than, say, a source file with tests?
Be sure to import all the libraries as discussed in the tutorial. Also, in the tutorial the source python files are provided as well -- read carefully and click the HREF.Marko.
--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/bfe168e0-1c54-4260-8ec6-c9bf3112ee0d%40googlegroups.com.
has errors; e.g., this following line fails:return self.range(indices,indices+1)trivial to fix (I assume "indeces" == "index", but has this been tested? Is it used by anyone?Huh. Again, I don't get an issue.
Huh. What version of Gremlin are you running? I just copy pasted that code into 3.2.1-SNAPSHOT (where the tutorial is for) and there were no issues.
Caught: groovy.lang.MissingPropertyException: No such property: GraphTraversalSource for class: gen
groovy.lang.MissingPropertyException: No such property: GraphTraversalSource for class: gen
at gen.run(gen.groovy:43)
3). gremlin-python.py isn't a valid python filename (for the sake of imports). This is trivial to fix, but again, makes me think it hasn't been tested.So this is the thing. With 3.2.1-SNAPSHOT (latest and greatest), we introduced the concept of Gremlin Language Variants. This is all very new. The tutorial is to help explain how to use reflection to "easily" build a language variant in any programming language. This is NOT tested and is NOT part of the distribution. There are lots of notes throughout the tutorial saying where my "slap dap" (express succinctly in a short tutorial) Gremlin-Python is awkward and should be made better.With that, we REALLY want to have at least 3 Gremlin language variants distributed with TinkerPop and tested against our process test suite. We are thinking:Gremlin-PythonGremlin-RubyGremlin-PHPI have not gotten around to figuring out a way to write a single "provider" by which any developed language variant can easily connect to our test suite. I DO NOT want to have a test suite for each and every variant as that will be a major overdose of code and will dissuade us from adding more languages moving forward.
In short, once we DO have a good test infrastructure for language variants, we will then release with a REAL Gremlin-Python and not just a "tutorial example."
Make sense?
4). Why put source code in the tutorial's text (i.e., if it's useful/intended to be used, why not put it in the the source distribution, or upload to PyPl?); perhaps I missed this? As I mentioned, the python libs listed here (http://tinkerpop.apache.org/docs/3.2.1-SNAPSHOT/tutorials/gremlin-language-variants) don't seem to have much traction. Would it be useful for me to create another python lib and have this listed?Yes -- we should really have Gremlin-Python distributed with TinkerPop. If you are interested in helping with this, we should collaborate. You being the Python expert and me being the guy who knows how to integrate everything into our test suite.
Again, thanks very much for your help.Thank you Rich. Apologies if I got your hopes up on Twitter with "just use Gremlin-Python." Its a "tutorial for developing a variant," NOT "the official Python language variant." :(
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/e88fce41-b839-47ce-9fef-c07f67c54c57%40googlegroups.com.
1). Here, I'm talking about the Groovy script you have in your tutorial (handy to have #links inside the doc?) starting with "pythonClass = new StringBuilder()". I've never used Groovy before so this is likely user error, but when I copy this script into, say "gen.groovy" then run "groovy gen.groovy" I get:
Is there a gremlin-python user group you're aware of? Any idea of how many people are using TinkerPop in Python?
tornado.httpclient.HTTPError: HTTP 400: Bad Request
Thanks Marko, will try this -- but how to automate -- would be ideal to build from a build script rather than insert a human into the process?
Also, what's the best way to submit issues:http://github.com/apache/incubator-tinkerpop has no public issues list.
But this repo doesn't build any more.
I'm guessing the new (supported) stack is http://github.com/apache/incubator-tinkerpop?
Sorry for the barrage of questions. Still getting started.
On Tuesday, May 31, 2016 at 6:30:02 PM UTC-4, Marko A. Rodriguez wrote:Hi,1). Here, I'm talking about the Groovy script you have in your tutorial (handy to have #links inside the doc?) starting with "pythonClass = new StringBuilder()". I've never used Groovy before so this is likely user error, but when I copy this script into, say "gen.groovy" then run "groovy gen.groovy" I get:Ah, you should run the script from the Gremlin Console as that has all the TinkerPop imports loaded.Is there a gremlin-python user group you're aware of? Any idea of how many people are using TinkerPop in Python?No. Just use gremlin-users@ mailing list.I'm working on https://github.com/apache/incubator-tinkerpop/tree/TINKERPOP-1278 which is for the ticket https://issues.apache.org/jira/browse/TINKERPOP-1278. You can see what I've been up to…Take care,Marko.
--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/419950ab-af00-4e5a-85d8-7e63ae73be51%40googlegroups.com.
>>> execfile("/Users/marko/software/tinkerpop/tinkerpop3/gremlin-variant/variants/python/gremlin-python-3.2.1-SNAPSHOT.py")>>> g = PythonGraphTraversalSource("g")>>> g.V()g.V()>>> g.V().out()g.V().out()>>> g.V().out()[0:1]g.V().out().range(0, 1)>>> g.V().out()[0:1].nameg.V().out().range(0, 1).values("name")>>> type(g.V().out()[0:1].name)<class '__main__.PythonGraphTraversal'>>>> g.V().out()[0:1].repeat(__.out("knows")).times(10).nameg.V().out().range(0, 1).repeat(__.out("knows")).times(10).values("name")>>> g.V().out()[0:1].repeat(__.out("knows")).times(10).name[2]g.V().out().range(0, 1).repeat(__.out("knows")).times(10).values("name").range(2, 3)>>> g.V().out()[0:1].repeat(__.out("knows")).times(10).name[2].groupCount().by("age")._as("a")g.V().out().range(0, 1).repeat(__.out("knows")).times(10).values("name").range(2, 3).groupCount().by("age").as("a")
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/3391c895-8ec2-46b8-a91d-a4b8679f2c91%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/3ADA6E94-6D4D-437A-A53E-92247D30A23E%40gmail.com.
~$ python Python 2.7.2 (default, Oct 11 2012, 20:14:37) [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> >>> >>> import sys >>> sys.path.append("/Users/marko/software/tinkerpop/tinkerpop3/gremlin-variant/src/main/jython/gremlin_python") >>> sys.path.append("/Users/marko/software/tinkerpop/tinkerpop3/gremlin-variant/src/main/jython/gremlin_driver") >>> sys.path.append("/Users/marko/software/tinkerpop/tinkerpop3/gremlin-variant/src/main/jython/gremlin_rest_driver") >>> >>> from gremlin_python import statics >>> from gremlin_python import PythonGraphTraversal >>> from gremlin_python import __ >>> from gremlin_rest_driver import RESTRemoteConnection >>> # this allows us to do g.V().repeat(out()) instead of g.V().repeat(__.out())-type traversals >>> for k in statics: ... globals()[k] = statics[k] ... >>> # create a remote connection (using REST) and pass it to PythonGraphTraversalSource >>> conn = RESTRemoteConnection('http://localhost:8182','gremlin-groovy') >>> g = PythonGraphTraversalSource("g",conn) >>> >>> # the __repr__ of PythonGraphTraversal is its Gremlin-Groovy compiled form >>> g.V().repeat(out()).times(2).name g.V().repeat(__.out()).times(2).values("name") >>> # toList() does the magic >>> g.V().repeat(out()).times(2).name.toList() [u'ripple', u'lop'] >>>
Hey Marko,g.addV() doesn't seem to create a vertex so I really don't understand a) above.Summary feedback :)1). Neo4J Hello world (add node and retrieve it).Result: Achieved in 10 minutes.2). TinkerPop Hello world (add node and retrieve it) via python-gremlin variant.Result: Still can't get working after 3 days (needing user group and your valuable time).3). Giving up on drivers and variants (today).Result: Achieved in 5 minutes:import jsonimport requestsimport easydict from EasyDictdef request(gremlin):
return requests.post('http://192.168.99.100:8182', headers={
'content-type': 'application/json'
}, data=json.dumps(dict(
gremlin=gremlin
)))
data = EasyDict(request('g.addV("name", "Hello")').json())
vid = data.result.data[0].id
print 'Created: %s' % vid
data = EasyDict(request('g.V(%s)' % vid).json())
print 'Retrieved: %s' % data.result.data[0].properties.name[0].value
Again, I appreciate you help. I think we'll move forward with the no-deps approach above for now.
--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/4c334f22-79f8-4495-969e-9fdae22ecd8a%40googlegroups.com.