Edgewall Software

Opened 10 years ago

Closed 8 years ago

#600 closed defect (duplicate)

Python3: Exception: Unhandled node type <class '_ast.NameConstant'>

Reported by: vagran.ast@… Owned by: cmlenz
Priority: major Milestone: 0.9
Component: Expression evaluation Version: 0.6
Keywords: Cc:

Description

pip3 show genshi
---
Name: Genshi
Version: 0.7
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cherrypy/_cprequest.py", line 670, in respond
    response.body = self.handler()
  File "/usr/lib/python3/dist-packages/cherrypy/lib/encoding.py", line 217, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/cherrypy/_cpdispatch.py", line 61, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/home/user/Dropbox/Databases/data/Homelab/app/pages.py", line 417, in index
    articleContent = stat.Render()).render('html')
  File "/home/user/Dropbox/Databases/data/Homelab/app/views.py", line 124, in Render
    newUrl = self.newUrl)
  File "/usr/local/lib/python3.4/dist-packages/genshi/template/base.py", line 544, in generate
    stream = self.stream
  File "/usr/local/lib/python3.4/dist-packages/genshi/template/base.py", line 454, in stream
    self._stream = list(self._prepare(self._stream))
  File "/usr/local/lib/python3.4/dist-packages/genshi/template/base.py", line 490, in _prepare
    yield kind, (directives, list(substream)), pos
  File "/usr/local/lib/python3.4/dist-packages/genshi/template/base.py", line 485, in _prepare
    namespaces, pos)
  File "/usr/local/lib/python3.4/dist-packages/genshi/template/directives.py", line 82, in attach
    return cls(value, template, namespaces, *pos[1:]), stream
  File "/usr/local/lib/python3.4/dist-packages/genshi/template/directives.py", line 60, in __init__
    self.expr = self._parse_expr(value, template, lineno, offset)
  File "/usr/local/lib/python3.4/dist-packages/genshi/template/directives.py", line 109, in _parse_expr
    lookup=template.lookup) or None
  File "/usr/local/lib/python3.4/dist-packages/genshi/template/eval.py", line 93, in __init__
    filename=filename, lineno=lineno, xform=xform)
  File "/usr/local/lib/python3.4/dist-packages/genshi/template/eval.py", line 463, in _compile
    new_source = ASTCodeGenerator(tree).code
  File "/usr/local/lib/python3.4/dist-packages/genshi/template/astutil.py", line 43, in __init__
    self.visit(tree)
  File "/usr/local/lib/python3.4/dist-packages/genshi/template/astutil.py", line 91, in visit
    ret = visitor(node)
  File "/usr/local/lib/python3.4/dist-packages/genshi/template/astutil.py", line 104, in visit_Expression
    return self.visit(node.body)
  File "/usr/local/lib/python3.4/dist-packages/genshi/template/astutil.py", line 91, in visit
    ret = visitor(node)
  File "/usr/local/lib/python3.4/dist-packages/genshi/template/astutil.py", line 501, in _f
    f(self, node)
  File "/usr/local/lib/python3.4/dist-packages/genshi/template/astutil.py", line 633, in visit_Compare
    self.visit(comparator)
  File "/usr/local/lib/python3.4/dist-packages/genshi/template/astutil.py", line 90, in visit
    raise Exception('Unhandled node type %r' % type(node))
Exception: Unhandled node type <class '_ast.NameConstant'>

Patch:

astutil.py:

    def visit_NameConstant(self, node):
        self._write(str(node.value))

and possibly:

visit_NameConstant = _clone

(not sure what is it)

Change History (3)

comment:1 Changed 8 years ago by hodgestar

  • Milestone changed from 0.7 to 0.9

Moved to milestone 0.9.

comment:2 Changed 8 years ago by jaraco@…

I'm pretty sure this is a duplicate of #582 (already fixed, just not released).

comment:3 Changed 8 years ago by hodgestar

  • Resolution set to duplicate
  • Status changed from new to closed

Agreed. Closing.

Note: See TracTickets for help on using tickets.