-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure environs are strings on Python2 + Windows
Patch based on theskumar/python-dotenv#101 by @greyli.
- Loading branch information
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
tasks/vendoring/patches/vendor/dotenv-windows-unicode.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
diff --git a/pipenv/vendor/dotenv/main.py b/pipenv/vendor/dotenv/main.py | ||
index 3d1bd72f..75f49c4a 100644 | ||
--- a/pipenv/vendor/dotenv/main.py | ||
+++ b/pipenv/vendor/dotenv/main.py | ||
@@ -94,6 +94,13 @@ class DotEnv(): | ||
for k, v in self.dict().items(): | ||
if k in os.environ and not override: | ||
continue | ||
+ # With Python 2 on Windows, ensuree environment variables are | ||
+ # system strings to avoid "TypeError: environment can only contain | ||
+ # strings" in Python's subprocess module. | ||
+ if sys.version_info.major < 3 and sys.platform == 'win32': | ||
+ from pipenv.utils import fs_str | ||
+ k = fs_str(k) | ||
+ v = fs_str(v) | ||
os.environ[k] = v | ||
|
||
return True |