[
https://issues.apache.org/jira/browse/TINKERPOP-2346?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Stephen Mallette closed TINKERPOP-2346.
---------------------------------------
Resolution: Not A Bug
I'm going to close this because I was able to get your error and then realized
what was wrong pretty quickly and then got things working (if it's still not
working please feel free to re-open). Basically, your syntax isn't quite right:
{code}
>>> g.V().valueMap().with_(WithOptions.tokens, WithOptions.ids).toList()
[{<T.id: 1>: 1, 'name': ['marko'], 'age': [29]}, {<T.id: 1>: 2, 'name':
['vadas'], 'age': [27]}, {<T.id: 1>: 3, 'name': ['lop'], 'lang': ['java']},
{<T.id: 1>: 4, 'name': ['josh'], 'age': [32]}, {<T.id: 1>: 5, 'name':
['ripple'], 'lang': ['java']}, {<T.id: 1>: 6, 'name': ['peter'], 'age': [35]}]
{code}
Basically, you need to include the {{WithOptions.tokens)}} as the first
argument. Note that this argument can be supplied alone to get:
{code}
>>> g.V().valueMap().with_(WithOptions.tokens).toList()
[{<T.id: 1>: 1, <T.label: 4>: 'person', 'name': ['marko'], 'age': [29]},
{<T.id: 1>: 2, <T.label: 4>: 'person', 'name': ['vadas'], 'age': [27]}, {<T.id:
1>: 3, <T.label: 4>: 'software', 'name': ['lop'], 'lang': ['java']}, {<T.id:
1>: 4, <T.label: 4>: 'person', 'name': ['josh'], 'age': [32]}, {<T.id: 1>: 5,
<T.label: 4>: 'software', 'name': ['ripple'], 'lang': ['java']}, {<T.id: 1>: 6,
<T.label: 4>: 'person', 'name': ['peter'], 'age': [35]}]
{code}
Also, don't forget that we now have {{elementMap()}} which is probably the best
way to get a {{Map}} of a graph element:
{code}
>>> g.V().elementMap().toList()
[{<T.id: 1>: 1, <T.label: 4>: 'person', 'name': 'marko', 'age': 29}, {<T.id:
1>: 2, <T.label: 4>: 'person', 'name': 'vadas', 'age': 27}, {<T.id: 1>: 3,
<T.label: 4>: 'software', 'name': 'lop', 'lang': 'java'}, {<T.id: 1>: 4,
<T.label: 4>: 'person', 'name': 'josh', 'age': 32}, {<T.id: 1>: 5, <T.label:
4>: 'software', 'name': 'ripple', 'lang': 'java'}, {<T.id: 1>: 6, <T.label: 4>:
'person', 'name': 'peter', 'age': 35}]
{code}
> In gremlin python, error when using 'valueMap' and 'with_' combined
> -------------------------------------------------------------------
>
> Key: TINKERPOP-2346
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2346
> Project: TinkerPop
> Issue Type: Bug
> Components: python
> Affects Versions: 3.4.5
> Reporter: Michael Kaiser-Cross
> Priority: Major
>
> Simple example that demonstrates issue.
> >>> g.V().valueMap().with_(WithOptions.ids).toList()
>
> gremlin_python.driver.protocol.GremlinServerError: 599: Could not locate
> method: DefaultGraphTraversal.with([1])
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)