-1

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

codyc4321
  • 9,014
  • 22
  • 92
  • 165
  • 2
    Try to run it using a `.py` file. – Ashwini Chaudhary Aug 09 '15 at 06:47
  • i'm beyond frustrated to try more tonight. do you have any advice for how to actually get any neo4j to work in any capacity whatsoever? I'd prefer to get it to work w django, but I've spent dozens of hours trying neo4django, py2neo, neomodel, and for each one you can spend over 10 hours configuring it and not get a single connection to the DB – codyc4321 Aug 09 '15 at 06:52
  • as in did you actually get neo4j to work with python at all yet? – codyc4321 Aug 09 '15 at 06:52
  • Never tried these modules, but this is a Python specific error, if `SP` is available in the global namespace then Python should be able to access it. – Ashwini Chaudhary Aug 09 '15 at 06:55
  • was there any module that neo4j actually works in? – codyc4321 Aug 09 '15 at 06:56
  • That's definitely not a python issue - it might be an IPython bug or something in your environment. Please always verify problems like this in the official interpreter with a clean environment _before_ asking on SO. – l4mpi Aug 09 '15 at 11:57

1 Answers1

3
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()
dsgdfg
  • 1,492
  • 11
  • 18
  • interesting, it worked outside Ipython. I've never had such a weird issue in ipython before but I'll check the interpreter first – codyc4321 Aug 09 '15 at 15:18