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
Upon install of stgit in a virtualenv in Windows, running stg show (or any command) throws the following error:
Error: Unhandled exception:
Traceback (most recent call last):
File "C:\Users\hborchardt\.pyenv\pyenv-win\versions\3.8.3-amd64\lib\site-packages\stgit\main.py", line 188, in _main
ret = command.func(parser, options, args)
File "C:\Users\hborchardt\.pyenv\pyenv-win\versions\3.8.3-amd64\lib\site-packages\stgit\commands\series.py", line 194, in func
stack = directory.repository.get_stack(options.branch)
File "C:\Users\hborchardt\.pyenv\pyenv-win\versions\3.8.3-amd64\lib\site-packages\stgit\lib\stack.py", line 428, in get_stack
name = self.current_branch_name
File "C:\Users\hborchardt\.pyenv\pyenv-win\versions\3.8.3-amd64\lib\site-packages\stgit\lib\git\repository.py", line 223, in current_branch_name
return utils.strip_prefix('refs/heads/', self.head_ref)
File "C:\Users\hborchardt\.pyenv\pyenv-win\versions\3.8.3-amd64\lib\site-packages\stgit\lib\git\repository.py", line 311, in head_ref
return self.run(['git', 'symbolic-ref', '-q', 'HEAD']).output_one_line()
File "C:\Users\hborchardt\.pyenv\pyenv-win\versions\3.8.3-amd64\lib\site-packages\stgit\run.py", line 254, in output_one_line
outlines = self.output_lines(sep)
File "C:\Users\hborchardt\.pyenv\pyenv-win\versions\3.8.3-amd64\lib\site-packages\stgit\run.py", line 245, in output_lines
outdata = self._run_io()
File "C:\Users\hborchardt\.pyenv\pyenv-win\versions\3.8.3-amd64\lib\site-packages\stgit\run.py", line 133, in _run_io
p = subprocess.Popen(
File "C:\Users\hborchardt\.pyenv\pyenv-win\versions\3.8.3-amd64\lib\subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\hborchardt\.pyenv\pyenv-win\versions\3.8.3-amd64\lib\subprocess.py", line 1307, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
TypeError: environment can only contain strings
My understanding, also from reading this comment (https://bugzilla.mozilla.org/show_bug.cgi?id=1585258#c4)
is, that this is a relict from Python2, and as Stgit supports Python >=3.5, that the opposite of fsencode_utf8 is required, fsdecode_utf8. On Linux, both strings and bytes are accepted, but Windows needs the env to be strings.
Stgit version: master (c01b32a)
Python version: 3.8.3
OS: Windows 10-msys2
The text was updated successfully, but these errors were encountered:
Turns out that changing to fsdecode_utf8 only works for Python >= 3.7, where PEP 540 UTF-8-Mode is included, and all conversions are using utf-8 anyway. On Python 3.5/3.6, if there are non-ascii characters in environment variables they have to be passed as bytes, such that they don't get converted by os.fsencode using the ascii codec in subprocess.Popen (which is the reason for the fsencode_utf8 function in the first place). It seems to me that this is not resolvable without a special case for windows systems.
Upon install of stgit in a virtualenv in Windows, running
stg show
(or any command) throws the following error:It can be quick-fixed on my system by replacing
stgit/stgit/run.py
Line 90 in c01b32a
My understanding, also from reading this comment (https://bugzilla.mozilla.org/show_bug.cgi?id=1585258#c4)
is, that this is a relict from Python2, and as Stgit supports Python >=3.5, that the opposite of
fsencode_utf8
is required,fsdecode_utf8
. On Linux, both strings and bytes are accepted, but Windows needs the env to be strings.Stgit version: master (c01b32a)
Python version: 3.8.3
OS: Windows 10-msys2
The text was updated successfully, but these errors were encountered: