You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "/home/xaver/Documents/Repos/taigaRESTInteraction/create_usertickets.py", line 22, in <module>
project = api.projects.get_by_slug(PROJECT_SLUG)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xaver/Documents/Repos/taigaRESTInteraction/venv/lib/python3.12/site-packages/taiga/models/models.py", line 1803, in get_by_slug
return self.instance.parse(self.requester, response.json())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xaver/Documents/Repos/taigaRESTInteraction/venv/lib/python3.12/site-packages/taiga/models/base.py", line 199, in parse
entry[key_to_parse] = cls_to_parse.parse(requester, entry[key_to_parse])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xaver/Documents/Repos/taigaRESTInteraction/venv/lib/python3.12/site-packages/taiga/models/base.py", line 107, in parse
for entry in entries:
TypeError: 'NoneType' object is not iterable
It's not like entries = [None] or something, but more that the parsers gets (last lines before error) see below. Logging format print("Entry {line of code in base.py where the print is placed}", entry):
I don't think I have django installed at least I can't import it python -c "import django; print(django.get_version())"
What application version do you mean? I installed python taiga via the pip command on Ubuntu24.04
Expected behaviour
Get the project - while I get a correct JSON response, the error occurs while interpreting it.
Actual behaviour
I get an error saying that entries can't be iterated.
Additional information
The JSON response looks correct. It is just the interpreting that throws the error. I will try to debug this further on my machine.
Fix?
I have just changed the ListResource method to:
@classmethoddefparse(cls, requester, entries):
"""Parse a JSON array into a list of model instances."""print("Entry 106:", entries)
result_entries=SearchableList()
forentryinentriesor []: # changed to handle the None caseresult_entries.append(cls.instance.parse(requester, entry))
returnresult_entries
not sure if that's a good way to handle it, but it seems to work for my needs for now.
The text was updated successfully, but these errors were encountered:
Thank you, @XaverStiensmeier, for identifying this issue and providing a fix! I encountered the same problem, and your solution worked perfectly for me.
Description
Executing:
I get:
It's not like
entries = [None]
or something, but more that the parsers gets (last lines before error) see below. Logging format print("Entry {line of code in base.py where the print is placed}", entry):Steps to reproduce
Versions
python -c "import django; print(django.get_version())"
Expected behaviour
Get the project - while I get a correct JSON response, the error occurs while interpreting it.
Actual behaviour
I get an error saying that entries can't be iterated.
Additional information
The JSON response looks correct. It is just the interpreting that throws the error. I will try to debug this further on my machine.
Fix?
I have just changed the
ListResource
method to:not sure if that's a good way to handle it, but it seems to work for my needs for now.
The text was updated successfully, but these errors were encountered: