Fix platform checking and env saving on Windows

This commit is contained in:
Régis Behmo 2020-11-12 12:56:18 +01:00
parent 2596e5f7d2
commit b2fdaf604e
3 changed files with 5 additions and 2 deletions

View File

@ -4,6 +4,9 @@ Note: Breaking changes between versions are indicated by "💥".
## Unreleased
- [Bugfix] Fix `config save` on Windows.
- [Bugfix] Fix platform checking in user ID function
## v10.4.1 (2020-11-11)
- [Bugfix] Fix dependency error during `pip install tutor` due to urllib3 incompatibility

View File

@ -231,7 +231,7 @@ def write_to(content, path):
if isinstance(content, bytes):
open_mode += "b"
utils.ensure_file_directory_exists(path)
with open(path, open_mode) as of:
with open(path, open_mode, encoding='utf8') as of:
of.write(content)

View File

@ -130,7 +130,7 @@ def get_user_id():
"""
Portable way to get user ID. Note: I have no idea if it actually works on windows...
"""
if sys.platform == "windows":
if sys.platform == "win32":
return int(check_output("id", "-u").decode())
return os.getuid()