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 "./turris-os-milestone-rename.py", line 60, in <module>
main()
File "./turris-os-milestone-rename.py", line 20, in main
issue.notes.create({'body': 'note content'})
File "/usr/lib/python3.8/site-packages/gitlab/exceptions.py", line 287, in wrapped_f
return f(*args, **kwargs)
File "/usr/lib/python3.8/site-packages/gitlab/mixins.py", line 325, in create
return self._obj_cls(self, server_data)
File "/usr/lib/python3.8/site-packages/gitlab/base.py", line 62, in __init__
self._create_managers()
File "/usr/lib/python3.8/site-packages/gitlab/base.py", line 151, in _create_managers
manager = cls(self.manager.gitlab, parent=self)
File "/usr/lib/python3.8/site-packages/gitlab/base.py", line 290, in __init__
self._computed_path = self._compute_path()
File "/usr/lib/python3.8/site-packages/gitlab/base.py", line 305, in _compute_path
data = {
File "/usr/lib/python3.8/site-packages/gitlab/base.py", line 306, in <dictcomp>
self_attr: getattr(self._parent, parent_attr, None)
File "/usr/lib/python3.8/site-packages/gitlab/base.py", line 80, in __getattr__
value = self.__dict__["_attrs"][name]
TypeError: list indices must be integers or slices, not str
$ ./t.py <class 'gitlab.v4.objects.Project'> => {'id': 265, ....
<class 'gitlab.v4.objects.ProjectIssue'> => {'id': 13996, 'iid': 729, 'project_id': 265, ...
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/gitlab/base.py", line 59, in __getattr__
return self.__dict__["_updated_attrs"][name]
KeyError: 'project_id'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./t.py", line 8, in <module>
issue.notes.create({'body': 'note content'})
File "/usr/lib/python3.8/site-packages/gitlab/exceptions.py", line 279, in wrapped_f
return f(*args, **kwargs)
File "/usr/lib/python3.8/site-packages/gitlab/mixins.py", line 215, in create
return self._obj_cls(self, server_data)
File "/usr/lib/python3.8/site-packages/gitlab/base.py", line 44, in __init__
self._create_managers()
File "/usr/lib/python3.8/site-packages/gitlab/base.py", line 129, in _create_managers
manager = cls(self.manager.gitlab, parent=self)
File "/usr/lib/python3.8/site-packages/gitlab/base.py", line 252, in __init__
self._computed_path = self._compute_path()
File "/usr/lib/python3.8/site-packages/gitlab/base.py", line 265, in _compute_path
data = {
File "/usr/lib/python3.8/site-packages/gitlab/base.py", line 266, in <dictcomp>
self_attr: getattr(self._parent, parent_attr, None)
File "/usr/lib/python3.8/site-packages/gitlab/base.py", line 62, in __getattr__
value = self.__dict__["_attrs"][name]
TypeError: list indices must be integers or slices, not str
I am sorry. I forgot to enable the environment. This was version 2.5.0. This is output from correct environment:
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/gitlab/base.py", line 77, in __getattr__
return self.__dict__["_updated_attrs"][name]
KeyError: 'project_id'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./t.py", line 8, in <module>
issue.notes.create({'body': 'note content'})
File "/usr/lib/python3.8/site-packages/gitlab/exceptions.py", line 287, in wrapped_f
return f(*args, **kwargs)
File "/usr/lib/python3.8/site-packages/gitlab/mixins.py", line 325, in create
return self._obj_cls(self, server_data)
File "/usr/lib/python3.8/site-packages/gitlab/base.py", line 62, in __init__
self._create_managers()
File "/usr/lib/python3.8/site-packages/gitlab/base.py", line 151, in _create_managers
manager = cls(self.manager.gitlab, parent=self)
File "/usr/lib/python3.8/site-packages/gitlab/base.py", line 290, in __init__
self._computed_path = self._compute_path()
File "/usr/lib/python3.8/site-packages/gitlab/base.py", line 305, in _compute_path
data = {
File "/usr/lib/python3.8/site-packages/gitlab/base.py", line 306, in <dictcomp>
self_attr: getattr(self._parent, parent_attr, None)
File "/usr/lib/python3.8/site-packages/gitlab/base.py", line 80, in __getattr__
value = self.__dict__["_attrs"][name]
TypeError: list indices must be integers or slices, not str
$ pip list | grep gitlab projects-teams-refactor%=
python-gitlab 2.7.1
@Cynerd this is caused by your nginx redirect to your new instance URL (from your instance login page), I was able to register on your gitlab and reproduce it, but then was able to post an issue note via the new URL:
Proxies can do weird stuff sometimes, not sure how many edge cases python-gitlab should really try to handle. We might try and investigate this in case it's more common.
Activity
JohnVillalovos commentedon May 27, 2021
I tried it without issue using gitlab.com:
JohnVillalovos commentedon May 28, 2021
Also there is a functional test that creates a note in an issue:
python-gitlab/tests/functional/api/test_issues.py
Line 28 in 90ecf2f
nejch commentedon May 30, 2021
@Cynerd I'm not able to reproduce this either. Could you post the entire snippet, maybe logs with
ctx.enable_debug()(with the token masked)?Does your token have write API access to the project? This definitely works in functional tests and 2 GitLab instances I've tried.
Cynerd commentedon May 30, 2021
This is the absolute minimal script to reproduce it:
It prints (with truncated lines):
JohnVillalovos commentedon May 30, 2021
Thanks for the info.
I don't understand this though:
Line 59 in
base.pyin version 2.7.1 does not have the linereturn self.__dict__["_updated_attrs"][name]python-gitlab/gitlab/base.py
Line 59 in 37af229
So that is confusing for me.
/usr/lib/python3.8/site-packages/gitlab/base.pyfile here.Thanks.
Cynerd commentedon May 30, 2021
I am sorry. I forgot to enable the environment. This was version 2.5.0. This is output from correct environment:
JohnVillalovos commentedon May 30, 2021
This is confusing.
Before creating the note can you do this?
Not sure why line 80 in
base.pyis failing. Seems like the__dict__or__dict__["_updated_attrs"]is corruptCynerd commentedon May 30, 2021
nejch commentedon May 30, 2021
@Cynerd this is caused by your nginx redirect to your new instance URL (from your instance login page), I was able to register on your gitlab and reproduce it, but then was able to post an issue note via the new URL:
So use the new URL and you should be fine:
ctx = gitlab.Gitlab("https://gitlab.nic.cz", private_token=token)Proxies can do weird stuff sometimes, not sure how many edge cases python-gitlab should really try to handle. We might try and investigate this in case it's more common.
JohnVillalovos commentedon May 30, 2021
@nejch Nice job figuring it out!