davebshow / goblin

A Python 3.5 rewrite of the TinkerPop 3 OGM Goblin
Other
93 stars 21 forks source link

Metaproperties example in docs fails #70

Closed John-Boik closed 7 years ago

John-Boik commented 7 years ago

It appears that the example code in the docs fails for metaproperties, at least on my system.

Here is my code, copied from the web docs:

import goblin
from aiogremlin.gremlin_python import Cardinality

class HistoricalName(goblin.VertexProperty):
    notes = goblin.Property(goblin.String)

class City(goblin.Vertex):
    name = goblin.Property(goblin.String)
    population = goblin.Property(goblin.Integer)
    historical_name = HistoricalName(
        goblin.String, card=Cardinality.list)

When I run this script, I get the error:

  File "/usr/lib/python3.5/enum.py", line 274, in __getattr__
    raise AttributeError(name) from None
AttributeError: list 

I'm using goblin 2.0.0, gremlin-python 3.2.5, aiogremlin 3.2.4.

John-Boik commented 7 years ago

The error seems to be with Cardinality. This causes the same error:

from aiogremlin.gremlin_python import Cardinality
Cardinality.list

Also, the same error is caused if Cardinality is imported as: from gremlin_python.process.traversal import Cardinality Any ideas for a workaround?

John-Boik commented 7 years ago

OK, easy fix. It seems that gremlinpython has changed Cardinality recently. Now it must be invoked as: `Cardinality.list`

davebshow commented 7 years ago

Ok I will go ahead and close this then.