Skip to content

Commit

Permalink
rollback to utf-8 encoding when exception get raised in encoding de…
Browse files Browse the repository at this point in the history
…tection
  • Loading branch information
AHReccese committed Jul 22, 2024
1 parent 847309c commit ffcb70e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions reserver/reserver_obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,10 @@ def upload(self, package_name, user_parameters=None):
except CalledProcessError as e:
publish_failed = True
error = e.output
print(chardet.detect(error)['encoding'])
print(error.decode('utf-8'))
error = error.decode(chardet.detect(error)['encoding'])
try:
error = error.decode(chardet.detect(error)['encoding'])
except:
error = error.decode('utf-8')
if command == commands[-2]:
if "403" in error and "Invalid or non-existent authentication information" in error:
error = "Invalid or non-existent authentication information(PyPI API Key)."
Expand Down

0 comments on commit ffcb70e

Please sign in to comment.