-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pipenv install blows up with a TypeError #2559
Comments
the question is really, how did the key come to be written as non-unicode? But we can fix this by doing better assurances . While it is easier to simply use strings, that is not really a good approach. Unicode exists for a lot of reasons and we do absolutely need to use it. |
IMO the correct way to achieve Python 2/3 support is to always use Unicode, not The comment in the s = simplejson.dumps( # Send Unicode in to guarentee Unicode out.
content, indent=4, separators=(u",", u": "), sort_keys=True
) shows that we (I?) were very concious about always using Unicode, just not doing it correctly. |
I'm not a maintainer so I guess I won't argue much about the implementation, whatever is convenient for y'all, though yes I certainly do disagree :). Anything else I can provide here to help track this down? |
Hmmmm did you already have a pipfile here? If so we might be a bit Unicode aggressive as you say. We are supposed to respect existing pipfile encoding |
So, that command above is a reproducer on this machine ( |
OK, this still fails with |
You have your locale set? |
Normally yes (though with I just found the problematic code though, it's here: https://github.com/pypa/pipenv/blob/master/pipenv/utils.py#L1262 Where that's assembling a dict with |
I had the same problem. Can we fix it in package too?
Then Edit: I guess it's about encoding of interaction between python and shell? How can we solve this permanently within the pipenv? |
My locale is appropriately set, see the original env dump at the top. The code I linked doesn't depend on the locale anyhow. |
Thanks for the debugging effort, and yeah, makes sense to me. For that I guess you’d need |
I’m updating #2561 to also ensure the lock file gets |
Getting this identical problem with most recent release, but I only get it when using pyenv. |
Issue description
Running
pipenv install foo
blows up with bytes being passed around where unicode is expected.Expected result
foo is installed.
Actual result
Steps to replicate
Instrumenting
pipenv.project
to just have it print the reprs of what it's trying to do shows that it's trying to callsimplejson.dumps
onproducing
which is a
str
(this is Py2).Note that things like the
version
key there in the dict has bytes as its value, not unicode (and despite a comment in the code there saying " # Send Unicode in to guarentee Unicode out.", which the code at least locally there seems to expect to be receiving).(Possible aside: from just glancing at that function, it seems like it's suffering from trying to use unicode on both Py2 and Py3, rather than using native strings on Py2 and Py3, which IME is way easier to do when dealing with files.)
$ pipenv --support
Pipenv version:
'2018.7.1'
Pipenv location:
'/Users/Julian/.local/share/virtualenvs/pipenv/site-packages/pipenv'
Python location:
'/Users/Julian/.local/share/virtualenvs/pipenv/bin/python'
Other Python installations in
PATH
:2.7
:/usr/local/bin/python2.7
2.7
:/usr/local/bin/python2.7
2.7
:/usr/bin/python2.7
3.7
:/usr/local/bin/python3.7m
3.7
:/usr/local/bin/python3.7
2.7.13
:/Users/Julian/.local/bin/python
2.7.15
:/usr/local/bin/python
2.7.10
:/usr/bin/python
2.7.15
:/Users/Julian/.local/bin/python2
2.7.15
:/usr/local/bin/python2
3.7.0
:/usr/local/bin/python3
PEP 508 Information:
System environment variables:
ANSIBLE_CONFIG
ANSIBLE_HOSTS
ANSIBLE_RETRY_FILES_SAVE_PATH
ANSIBLE_VAULT_PASSWORD_FILE
AWS_CONFIG_FILE
AWS_SHARED_CREDENTIALS_FILE
Apple_PubSub_Socket_Render
BOTO_CONFIG
BROWSER
BUNDLE_CONFIG
CENTOS_7_AMI
CHEF_PATH
COLORFGBG
COLORTERM
COMMAND_MODE
CTAGS
DELETE_ON_TERMINATION
DEVELOPMENT
DISPLAY
DOCKER_CONFIG
EDITOR
GEM_HOME
GEM_SPEC_CACHE
GIT_TEMPLATE_DIR
GNUPGHOME
GPG_TTY
HOME
HTTPIE_CONFIG_DIR
INPUTRC
IS_DEVELOPMENT_WORKSTATION
ITERM_PROFILE
ITERM_SESSION_ID
LANGUAGE
LEIN_HOME
LESSHISTFILE
LOGNAME
LS_COLORS
M2_HOME
MAGNETIC_DEVELOPMENT
MYSQL_HISTFILE
NOTMUCH_CONFIG
NPM_CONFIG_USERCONFIG
NVIM_TUI_ENABLE_CURSOR_SHAPE
OLDPWD
PATH
PERL5LIB
PERL_CPANM_HOME
PERL_LOCAL_LIB_ROOT
PERL_MB_OPT
PERL_MM_OPT
PIP_CONFIG_FILE
PSQL_HISTORY
PWD
PYTHONDONTWRITEBYTECODE
PYTHONSTARTUP
PYTHONWARNINGS
PYTHON_TEST_RUNNER
SECURITYSESSIONID
SHELL
SHLVL
SSH_AUTH_SOCK
STARDICT_DATA_DIR
TASKRC
TERM
TERM_PROGRAM
TERM_PROGRAM_VERSION
TERM_SESSION_ID
TMPDIR
TMUX
TMUX_PANE
USER
VIRTUALENVS
XDG_CACHE_HOME
XDG_CONFIG_HOME
XDG_DATA_HOME
XDG_DESKTOP_DIR
XDG_DOCUMENTS_DIR
XDG_DOWNLOAD_DIR
XDG_MUSIC_DIR
XDG_PICTURES_DIR
XDG_PUBLICSHARE_DIR
XDG_TEMPLATES_DIR
XDG_VIDEOS_DIR
XINITRC
XPC_FLAGS
XPC_SERVICE_NAME
ZDOTDIR
ZSHPLUGINS
__CF_USER_TEXT_ENCODING
C_INCLUDE_PATH
CPLUS_INCLUDE_PATH
GOPATH
LIBRARY_PATH
LD_LIBRARY_PATH
PKG_CONFIG_PATH
NODEPATH
PYTHONPATH
HGRCPATH
WORKON_HOME
LANG
LC_ALL
_
PIP_PYTHON_PATH
Pipenv–specific environment variables:
Debug–specific environment variables:
PATH
:/Users/Julian/.local/bin:/usr/local/bin:/usr/local/sbin:/Users/Julian/.local/share/gem/bin:/Users/Julian/Library/Application Support/go/bin:/usr/local/share/pypy:/usr/local/share/pypy3:/usr/local/share/npm/bin:/usr/local/opt/coreutils/libexec/gnubin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/Wireshark.app/Contents/MacOS:/Users/Julian/Library/Application Support/perl5/bin
SHELL
:/usr/local/bin/zsh
EDITOR
:nvim
LANG
:en_US.UTF-8
PWD
:/Users/Julian/Desktop
The text was updated successfully, but these errors were encountered: