-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rez-release UnicodeDecodeError (windows) #776
Comments
I wonder if this is the same stuff I saw.
|
sorry, nevermind after the successful release I cannot reproduce it. The next time I encounter it (it's only happened twice) I'll try that. I'll close this issue until I can reproduce it. Thanks again @bfloch |
I found the cause!! For some reason, this is only occurring during some rez-releases, despite them all sharing the same git history. There is a reverse-line-feed character in the git commit log, that is causing I'll make a pull request in a minute, but I was able to solve this by decoding the bytestring myself instead of using example failurepipe = subprocess.Popen(
['git', 'log'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True)
(stdout, _) = pipe.communicate()
Exception in thread Thread-3:
Traceback (most recent call last):
File "C:\Python-3.6.5\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\Python-3.6.5\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "C:\Python-3.6.5\lib\subprocess.py", line 1063, in _readerthread
buffer.append(fh.read())
File "C:\Python-3.6.5\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 1023172: character maps to <undefined> workaroundpipe = subprocess.Popen(['git', 'log'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, _) = pipe.communicate()
stdout_unicode = stdout.decode('utf-8') |
Sorry and for completion, I did try setting |
Snip from slack: Allan Johns 9:28 AM |
So, I think the better fix may be t oset `encoding='utf-8' in our Popen wrapper. This will force UTF-8 decoding when text=True, which feels cleaner than having to explicitly decode as above. Also, I am assuming this that problem could occur wherever we use Popen, so this way the fix is applied across the board. Do you mind trying this out? See from https://docs.python.org/3/library/subprocess.html#frequently-used-arguments:
|
yes! that works. thank you so much! |
incoming update to PR... |
fixed. |
Occurs when rez-releasing a package on windows, if the git repostiory already has the tag wanted by the rez-release.Occured during
rez-release
, when it runsgit log
in subprocess withtext=True
, and log containschr(141)
.The text was updated successfully, but these errors were encountered: