Cycler object has no attribute 'next' in Python 3.4.3
See original GitHub issuePython 3.4.3, Pyramid 1.5.7, Jinja 2.8 (2.7.3 produce the same error)
I got a weird exception
jinja2.exceptions.UndefinedError: 'jinja2.utils.Cycler object' has no attribute 'next'
in string
<li class='struct-item{{ row.next() }}' data-id="{{ category._id }}"
data-owner="{{ category.owner }}">
template:
<ul>
{% set row = cycler('', ' back') %}
{% for category in categories[0] recursive %}
<li class='struct-item{{ row.next() }}' data-id="{{ category._id }}"
data-owner="{{ category.owner }}">
<div class="title">{{ category.caption }}</div>
<div class="action">
{% if not loop.depth0 %}
<a href='#' class="category-add">
<img src='/static/admin/img/action-add.png'>
</a>
{% endif %}
<a href='#' class="category-edit">
<img src='/static/admin/img/action-edit.png'>
</a>
<a href='#' class="category-delete">
<img src='/static/admin/img/action-delete.png'>
</a>
</div>
</li>
{% if category._id in categories %}
<ul class="children">{{ loop(categories[category._id]) }}</ul>
{% endif %}
{% endfor %}
</ul>
When I make a call print(dir(self)) in a constructor Cycler, echo was
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__',
'__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__',
'__module__', '__ne__', '__new__', '__next__', '__reduce__', '__reduce_ex__',
'__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__',
'current', 'items', 'pos', 'reset']
that means Cycler object really has no next
method. Temporary fix is jinja2.utils.Cycler.next = jinja2.utils.Cycler.__next__
in a Pyramidmain
method, but…
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
AttributeError: 'Cycler' object has no attribute 'change_key'
Just checked the version of cycler and it was outdated. Just update cycler with. sudo pip3 install --upgrade cycler.
Read more >3. Data model — Python 3.11.1 documentation
Objects, values and types: Objects are Python's abstraction for data. All data in a Python program is represented by objects or by relations...
Read more >ℎ - Nick Coghlan's Python Notes
the next major version of Red Hat Enterprise Linux (previously this had been ... AttributeError: 'bytes' object has no attribute 'encode'.
Read more >Customizing Matplotlib with style sheets and rcParams
Runtime rc settings#. You can dynamically change the default rc (runtime configuration) settings in a python script or interactively from the python shell....
Read more >Matplotlib pane throwing AttributeError when interactive=True
I have a panel app utilizing Matplotlib panes. ... flush_figures) AttributeError: 'NoneType' object has no attribute 'events'.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey guys. This issue has been opened more than month ago.
This can be fixed by adding almost the same function
implements_iterator
in code blockif not PY2
in_compat.py
.And I’m very sorry, I was wrong. In Python 2.7.3 current release works fine, as expected.