mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 14:56:14 +01:00
1933da5bcc
Using os.getcwd() in combination with a subsequent .encode() is error
prone:
marcus@linux:~> mkdir illegal_utf-8_encoding_$'\xff'_dir
marcus@linux:~> cd illegal_utf-8_encoding_$'\xff'_dir/
marcus@linux:~/illegal_utf-8_encoding_ÿ_dir> python3
Python 3.8.6 (default, Nov 09 2020, 12:09:06) [GCC] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.getcwd().encode()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'utf-8' codec can't encode character '\udcff' in position 36: surrogates not allowed
>>>
Hence, use os.getcwdb(), which returns a bytes, instead of
os.getcwd().encode().
Fixes: commit
|
||
---|---|---|
.. | ||
__init__.py | ||
ar.py | ||
archquery.py | ||
cpio.py | ||
debquery.py | ||
helper.py | ||
packagequery.py | ||
repodata.py | ||
rpmquery.py | ||
safewriter.py |