命名空间中的名称如何未定义 Python?
how can a name in the namespace be undefined Python?
我在尝试关注 http://neomodel.readthedocs.org/en/latest/getting_started.html#connecting
时遇到了一个荒谬的错误
我刚刚从这个环境中卸载了 neo4django,因为它的名称是 StringProperty,我正在尝试为 neo4j 创建一个 class:
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
如您所见,自动完成功能证明该名称存在。这个新模型是特定的还是有一个普遍的 Python 原因导致存在的名称未定义?谢谢
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()
我在尝试关注 http://neomodel.readthedocs.org/en/latest/getting_started.html#connecting
时遇到了一个荒谬的错误我刚刚从这个环境中卸载了 neo4django,因为它的名称是 StringProperty,我正在尝试为 neo4j 创建一个 class:
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
如您所见,自动完成功能证明该名称存在。这个新模型是特定的还是有一个普遍的 Python 原因导致存在的名称未定义?谢谢
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()