mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Fix UnicodeEncodeError in help.py
This commit is contained in:
+12
-4
@@ -9,6 +9,13 @@ from .core import project, system_which, find_python_in_path, python_version
|
||||
from .pep508checker import lookup
|
||||
|
||||
|
||||
def print_utf(line):
|
||||
try:
|
||||
print(line)
|
||||
except UnicodeEncodeError:
|
||||
print(line.encode('utf-8'))
|
||||
|
||||
|
||||
def main():
|
||||
print('<details><summary>$ python -m pipenv.help output</summary>')
|
||||
print('')
|
||||
@@ -45,13 +52,13 @@ def main():
|
||||
for key in os.environ:
|
||||
print(' - `{0}`'.format(key))
|
||||
print('')
|
||||
print(u'Pipenv–specific environment variables:')
|
||||
print_utf(u'Pipenv–specific environment variables:')
|
||||
print('')
|
||||
for key in os.environ:
|
||||
if key.startswith('PIPENV'):
|
||||
print(' - `{0}`: `{1}`'.format(key, os.environ[key]))
|
||||
print('')
|
||||
print(u'Debug–specific environment variables:')
|
||||
print_utf(u'Debug–specific environment variables:')
|
||||
print('')
|
||||
for key in ('PATH', 'SHELL', 'EDITOR', 'LANG', 'PWD', 'VIRTUAL_ENV'):
|
||||
if key in os.environ:
|
||||
@@ -61,7 +68,7 @@ def main():
|
||||
print('---------------------------')
|
||||
print('')
|
||||
if project.pipfile_exists:
|
||||
print(
|
||||
print_utf(
|
||||
u'Contents of `Pipfile` ({0!r}):'.format(project.pipfile_location)
|
||||
)
|
||||
print('')
|
||||
@@ -72,7 +79,7 @@ def main():
|
||||
print('')
|
||||
if project.lockfile_exists:
|
||||
print('')
|
||||
print(
|
||||
print_utf(
|
||||
u'Contents of `Pipfile.lock` ({0!r}):'.format(
|
||||
project.lockfile_location
|
||||
)
|
||||
@@ -87,3 +94,4 @@ def main():
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user