pythonneo4jneomodel

how can a name in the namespace be undefined Python?


I have a ludicrous error while trying to follow http://neomodel.readthedocs.org/en/latest/getting_started.html#connecting

I just uninstalled neo4django from this environment because it has the name StringProperty, and I am trying to make a class for neo4j:

In [8]: from neomodel import StringProperty as SP

In [9]: class Person(StructuredNode):
   ...:     name = SP()
   ...:     
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
/home/cchilders/.local/virtualenv/another_neo4django_attempt/local/lib/python2.7/site-packages/django/core/management/commands/shell.pyc in <module>()
----> 1 class Person(StructuredNode):
      2     name = SP()
      3 

/home/cchilders/.local/virtualenv/another_neo4django_attempt/local/lib/python2.7/site-packages/django/core/management/commands/shell.pyc in Person()
      1 class Person(StructuredNode):
----> 2     name = SP()
      3 

NameError: name 'SP' is not defined

In [10]: S
%%SVG           StopIteration   SyntaxError     SystemExit
SP              StringProperty  SyntaxWarning   
StandardError   StructuredNode  SystemError 

as you can see, autocomplete proves the name is there. Is this neomodel specific or is there a general Python reason for a name that exists to come up undefined? Thank you


Solution

  • Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
    [GCC 4.8.2] on linux2
    Type "copyright", "credits" or "license()" for more information.
    >>> from neomodel import StringProperty as SP
    >>> from neomodel import (StructuredNode, IntegerProperty,
        RelationshipTo, RelationshipFrom)
    >>> 
    >>> class Person(StructuredNode):
        name = SP()