question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AttributeError: module 'py2neo.cypher.error.statement' has no attribute 'TypeError'

See original GitHub issue

Code


from neomodel import (StructuredNode, StringProperty, IntegerProperty, BooleanProperty, OneOrMore, One,
    RelationshipTo, RelationshipFrom)

class Person(StructuredNode):
    name = StringProperty(required=True, index=True)

    phone = RelationshipTo('Phone', 'HAS_PHONE', cardinality=One)
    friend = RelationshipTo('Person', 'FRIEND')

class Phone(StructuredNode):
    phone = StringProperty(required=True, unique_index=True)
    is_user = BooleanProperty(Required=True, default=False)

    owns = RelationshipFrom('Person', 'BELONGS_TO', cardinality=OneOrMore)

kr = Person(name='A').save()

Here is the Traceback


AttributeError                            Traceback (most recent call last)
<ipython-input-5-42ec92807bc3> in <module>()
----> 1 kr = Person(name='A').save()

/Users/krace/anaconda3/lib/python3.5/site-packages/neomodel/signals.py in hooked(self, *args, **kwargs)
     23         fn_name = fn.func_name if hasattr(fn, 'func_name') else fn.__name__
     24         exec_hook('pre_' + fn_name, self, *args, **kwargs)
---> 25         val = fn(self, *args, **kwargs)
     26         exec_hook('post_' + fn_name, self, *args, **kwargs)
     27         return val

/Users/krace/anaconda3/lib/python3.5/site-packages/neomodel/core.py in save(self)
    157                 self.__class__.__name__))
    158         else:  # create
--> 159             self._id = self.create(self.__properties__)[0]._id
    160         return self
    161 

/Users/krace/anaconda3/lib/python3.5/site-packages/neomodel/core.py in create(cls, *props, **kwargs)
    287         else:
    288             # fetch and build instance for each result
--> 289             results = db.cypher_query(query, params)
    290 
    291             if not lazy and hasattr(cls, 'post_create'):

/Users/krace/anaconda3/lib/python3.5/site-packages/neomodel/util.py in cypher_query(self, query, params, handle_unique)
    209         try:
    210             start = time.clock()
--> 211             results = self._execute_query(query, params)
    212             end = time.clock()
    213         except (ClientError, TransactionError) as e:

/Users/krace/anaconda3/lib/python3.5/site-packages/neomodel/util.py in _execute_query(self, query, params)
    203             if not hasattr(self, 'session'):
    204                 self.new_session()
--> 205             results = self.session.cypher.execute(query, params)
    206             return results, list(results.columns)
    207 

/Users/krace/anaconda3/lib/python3.5/site-packages/py2neo/cypher/core.py in execute(self, statement, parameters, **kwparameters)
    109             tx = CypherTransaction(self.transaction_uri)
    110             tx.append(statement, parameters, **kwparameters)
--> 111             results = tx.commit()
    112             return results[0]
    113         else:

/Users/krace/anaconda3/lib/python3.5/site-packages/py2neo/cypher/core.py in commit(self)
    304         log.info("commit")
    305         try:
--> 306             return self.post(self.__commit or self.__begin_commit)
    307         finally:
    308             self.__finished = True

/Users/krace/anaconda3/lib/python3.5/site-packages/py2neo/cypher/core.py in post(self, resource)
    259             if len(errors) >= 1:
    260                 error = errors[0]
--> 261                 raise self.error_class.hydrate(error)
    262         out = RecordListList()
    263         for result in j["results"]:

/Users/krace/anaconda3/lib/python3.5/site-packages/py2neo/cypher/error/core.py in hydrate(cls, data)
     52         _, classification, category, title = code.split(".")
     53         error_module = import_module("py2neo.cypher.error." + category.lower())
---> 54         error_cls = getattr(error_module, title)
     55         inst = error_cls(message)
     56         inst.code = code

AttributeError: module 'py2neo.cypher.error.statement' has no attribute 'TypeError'

List of the dependencies version

krace@Kracekumars-MacBook-Pro ~> pip3 freeze | grep neomodel
neomodel==2.0.2
krace@Kracekumars-MacBook-Pro ~> pip3 freeze | grep py2neo
py2neo==2.0.7

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

3reactions
the4thvcommented, Jul 1, 2016

@kracekumar, that version of Neo4j is not supported by py2neo 2.x or Neomodel (at all). I’m working on the neomodel version that will support Neo4j 3 at the moment. For now, I’d recommend you use Neo4j 2.3.5

0reactions
robinedwardscommented, Nov 21, 2016

Hi @kracekumar I’ve just upgraded neomodel to support neo4j 3, please trying using git master and let me know if you have any issues. Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

neo4j - py2neo - Unable to place parameters into relationship ...
If I run my python script over neo4j database, works ok: from py2neo import Node, Relationship, Graph ...
Read more >
Source code for py2neo.database
Note that py2neo does not support routing with a Neo4j causal cluster ... __name__ except (AttributeError, TypeError): return False def __ne__(self, ...
Read more >
Py2neo error “AttributeError: 'NoneType' object ha... - Neo4j
I keep getting error from Py2neo: "AttributeError: 'NoneType' object has no attribute 'graph'" when I am trying to create some - 26922.
Read more >
TypeError: 'NoneType' object is not subscriptable
In general, the error means that you attempted to index an object that doesn't have that functionality. You might have noticed that the...
Read more >
Incompatibilities moving from Python 2 to Python 3 - DevTut
needs to be the first statement in a module from __future__ import division ... are Unicode by default, prepending a string literal with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found