Fixed encoding error while piped output#26
Fixed encoding error while piped output#26baldulin wants to merge 1 commit intopython-gitlab:masterfrom baldulin:master
Conversation
If a ran python-gitlab with the -v option piping to another process was not possible. This was due to the fact that sys.stdout.encoding was set to None. The problem is solved if the default encoding is used if sys.stdout.encoding is None.
|
How about use sys.stdout.encoding if sys.stdout.encoding is not None else sys.getdefaultencoding() instead? BTW, there are three sys.stdout.encoding. |
|
You mean exchange those four lines with the one liner? I think that line will be to long then. What there are three encodings safed like |
|
Ah you mean line 305, yeah that would need some changes too. |
|
I also ran into this and made my own fix: https://github.com/cdleonard/python-gitlab/commits/master I think at line 305 using sys.stdout.encoding or sys.getdefaultencoding() would be wrong. Instead strings should be encoded in a format that the gitlab API understands. Sadly they have some issues with that in upstream: https://github.com/gitlabhq/gitlabhq/issues/6244 so it's not clear what the correct format would be. |
|
Yap that was my problem too. I'm not sure what encoding was intendet to be used. |
|
Hi, I merged #27, which worked fine for me and was a bit cleaner IMO. Thanks for tackling this anyway. |
If a ran python-gitlab with the -v option piping to another process
was not possible. This was due to the fact that sys.stdout.encoding
was set to None.
The problem is solved if the default encoding is used instead of
sys.stdout.encoding if it is set to None.
Here the Traceback:
Traceback (most recent call last):
File "/usr/bin/gitlab", line 5, in
pkg_resources.run_script('python-gitlab==0.6', 'gitlab')
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 528, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 1401, in run_script
exec(script_code, namespace, namespace)
File "/usr/lib/python2.7/site-packages/python_gitlab-0.6-py2.7.egg/EGG-INFO/scripts/gitlab", line 337, in