I got an error working on Windows 10 with python 3.6.3, bump2version v0.5.7.
The traceback message is:
Traceback (most recent call last):
File "c:\program files (x86)\python36-32\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\program files (x86)\python36-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Program Files (x86)\Python36-32\Scripts\bump2version.exe\__main__.py", line 9, in <module>
File "c:\program files (x86)\python36-32\lib\site-packages\bumpversion\__init__.py", line 938, in main
vcs.commit(message=commit_message)
File "c:\program files (x86)\python36-32\lib\site-packages\bumpversion\__init__.py", line 75, in commit
list(os.environ.items()) + [(b'HGENCODING', b'utf-8')]
File "c:\program files (x86)\python36-32\lib\subprocess.py", line 336, in check_output
**kwargs).stdout
File "c:\program files (x86)\python36-32\lib\subprocess.py", line 403, in run
with Popen(*popenargs, **kwargs) as process:
File "c:\program files (x86)\python36-32\lib\subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "c:\program files (x86)\python36-32\lib\subprocess.py", line 997, in _execute_child
startupinfo)
TypeError: environment can only contain strings
Actually, I solved the issue changing the class BaseVCS in __init__.py as follows:
class BaseVCS(object):
@classmethod
def commit(cls, message):
f = NamedTemporaryFile('wb', delete=False)
f.write(message.encode('utf-8'))
f.close()
subprocess.check_output(cls._COMMIT_COMMAND + [f.name], env=dict(
[i for i in os.environ.items()] + [(u'HGENCODING', u'utf-8')]
))
os.unlink(f.name)
@classmethod
def is_usable(cls):
try:
return subprocess.call(
cls._TEST_USABLE_COMMAND,
stderr=subprocess.PIPE,
stdout=subprocess.PIPE
) == 0
except OSError as e:
if e.errno == 2:
# mercurial is not installed then, ok.
return False
raise
As you can see, I only changed the params for subprocess.check_output:
subprocess.check_output(cls._COMMIT_COMMAND + [f.name], env=dict(
[i for i in os.environ.items()] + [(u'HGENCODING', u'utf-8')]
I got an error working on Windows 10 with python 3.6.3, bump2version v0.5.7.
The traceback message is:
Actually, I solved the issue changing the class
BaseVCS
in__init__.py
as follows:As you can see, I only changed the params for
subprocess.check_output
: