Skip to content

Instantly share code, notes, and snippets.

@elena
Created July 3, 2018 10:36
Show Gist options
  • Save elena/07f99ad209efc9d9accea4625149088e to your computer and use it in GitHub Desktop.
Save elena/07f99ad209efc9d9accea4625149088e to your computer and use it in GitHub Desktop.
py2neo date bug -- fortunately easy to replicate
versions:
Pipfile.lock
"py2neo": {
"hashes": [
"sha256:09805b0a2980607ed633689aceae26516f530795fef540ebcf26ab06faef3b38"
],
"index": "pypi",
"version": "==4.0.0"
},
$ neo4j version
neo4j 3.4.1
create (n {name: "nige", mydate: date("2018-07-03")});
g = Graph()
g.nodes.match(name="nige").first()
# kablooey
# Trace:
Out[3]: ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
~/.virtualenvs/project-ESAEOAkK/lib/python3.5/site-packages/IPython/core/formatters.py in __call__(self, obj)
700 type_pprinters=self.type_printers,
701 deferred_pprinters=self.deferred_printers)
--> 702 printer.pretty(obj)
703 printer.flush()
704 return stream.getvalue()
~/.virtualenvs/project-ESAEOAkK/lib/python3.5/site-packages/IPython/lib/pretty.py in pretty(self, obj)
398 if cls is not object \
399 and callable(cls.__dict__.get('__repr__')):
--> 400 return _repr_pprint(obj, self, cycle)
401
402 return _default_pprint(obj, self, cycle)
~/.virtualenvs/project-ESAEOAkK/lib/python3.5/site-packages/IPython/lib/pretty.py in _repr_pprint(obj, p, cycle)
693 """A pprint that just redirects to the normal repr function."""
694 # Find newlines and replace them with p.break_()
--> 695 output = repr(obj)
696 for idx,output_line in enumerate(output.splitlines()):
697 if idx:
~/.virtualenvs/project-ESAEOAkK/lib/python3.5/site-packages/py2neo/data.py in __repr__(self)
766
767 def __repr__(self):
--> 768 return Walkable.__repr__(self)
769
770 def __bool__(self):
~/.virtualenvs/project-ESAEOAkK/lib/python3.5/site-packages/py2neo/data.py in __repr__(self)
668
669 def __repr__(self):
--> 670 return xstr(cypher_repr(self))
671
672 def __eq__(self, other):
~/.virtualenvs/project-ESAEOAkK/lib/python3.5/site-packages/py2neo/cypher/__init__.py in cypher_repr(value, **kwargs)
315 """
316 encoder = CypherEncoder(**kwargs)
--> 317 return encoder.encode_value(value)
318
319
~/.virtualenvs/project-ESAEOAkK/lib/python3.5/site-packages/py2neo/cypher/__init__.py in encode_value(self, value)
176 return self.encode_string(value)
177 if isinstance(value, Node):
--> 178 return self.encode_node(value)
179 if isinstance(value, Relationship):
180 return self.encode_relationship(value)
~/.virtualenvs/project-ESAEOAkK/lib/python3.5/site-packages/py2neo/cypher/__init__.py in encode_node(self, node)
222
223 def encode_node(self, node):
--> 224 return self._encode_node(node, self.node_template)
225
226 def encode_relationship(self, relationship):
~/.virtualenvs/project-ESAEOAkK/lib/python3.5/site-packages/py2neo/cypher/__init__.py in _encode_node(self, node, template)
261 property=PropertySelector(node, u""),
262 name=node.__name__,
--> 263 ).strip() + u")"
264
265 def _encode_relationship_detail(self, relationship, template):
~/.virtualenvs/project-ESAEOAkK/lib/python3.5/site-packages/py2neo/cypher/__init__.py in __repr__(self)
86 else:
87 properties = OrderedDict((key, self.__items[key]) for key in sorted(self.__items))
---> 88 return cypher_repr(properties, **self.__kwargs)
89
90 def __getattr__(self, key):
~/.virtualenvs/project-ESAEOAkK/lib/python3.5/site-packages/py2neo/cypher/__init__.py in cypher_repr(value, **kwargs)
315 """
316 encoder = CypherEncoder(**kwargs)
--> 317 return encoder.encode_value(value)
318
319
~/.virtualenvs/project-ESAEOAkK/lib/python3.5/site-packages/py2neo/cypher/__init__.py in encode_value(self, value)
184 return self.encode_list(value)
185 if isinstance(value, dict):
--> 186 return self.encode_map(value)
187 raise TypeError("Values of type %s.%s are not supported" % (type(value).__module__, type(value).__name__))
188
~/.virtualenvs/project-ESAEOAkK/lib/python3.5/site-packages/py2neo/cypher/__init__.py in encode_map(self, values)
219 def encode_map(self, values):
220 return u"{" + self.sequence_separator.join(self.encode_key(key) + self.key_value_separator + self.encode_value(value)
--> 221 for key, value in values.items()) + u"}"
222
223 def encode_node(self, node):
~/.virtualenvs/project-ESAEOAkK/lib/python3.5/site-packages/py2neo/cypher/__init__.py in <genexpr>(.0)
219 def encode_map(self, values):
220 return u"{" + self.sequence_separator.join(self.encode_key(key) + self.key_value_separator + self.encode_value(value)
--> 221 for key, value in values.items()) + u"}"
222
223 def encode_node(self, node):
~/.virtualenvs/project-ESAEOAkK/lib/python3.5/site-packages/py2neo/cypher/__init__.py in encode_value(self, value)
185 if isinstance(value, dict):
186 return self.encode_map(value)
--> 187 raise TypeError("Values of type %s.%s are not supported" % (type(value).__module__, type(value).__name__))
188
189 def encode_string(self, value):
TypeError: Values of type neotime.Date are not supported
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment