Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Gracefully handle pip UnicodeDecodeError #122

Closed
edmorley opened this issue Feb 19, 2016 · 10 comments
Closed

Gracefully handle pip UnicodeDecodeError #122

edmorley opened this issue Feb 19, 2016 · 10 comments

Comments

@edmorley
Copy link
Contributor

In #120 pip failed with a UnicodeDecodeError due to something unrelated to peep. However this resulted in the "Peep had a problem" message, which encourages users to file an issue against Peep.

Now ideally pip shouldn't raise UnicodeDecodeError, but even if that's fixed in pip (either in the latest release or in the future), people will be using affected versions for a while.

As such, we should probably do something similar to #118 but for UnicodeDecodeError.

@erikrose
Copy link
Owner

Ugh. I'm not sure what to do about this; we certainly wouldn't want to swallow our own UnicodeDecodeErrors if we were to accidentally start throwing them.

@edmorley
Copy link
Contributor Author

True, though I guess it wouldn't be silent per-se, we just would only show the original pip error rather than implying it was peep's fault. There is a small chance that people may then file issues against pip that are really peep's fault, but presumably our tests would catch those?

@erikrose
Copy link
Owner

erikrose commented Feb 19, 2016 via email

@erikrose
Copy link
Owner

erikrose commented Mar 2, 2016

Okay, we're having a zillion of these with Let's Encrypt, so my opinion of this is rapidly changing.

#129
#128
#127
#125

@szbaig
Copy link

szbaig commented Mar 2, 2016

@erikrose - not to pile on but adding to this issue incase more info helps. Here is the error message I'm getting - pretty much the same story you have already been notified of -

peep: (3, 1, 1)
python: '2.7.11 (default, Dec 15 2015, 16:46:19)
[GCC 4.8.4]'
pip: '1.5.4'
Command line: ['/tmp/tmp.2Qoq6J4acW/peep.py', 'install', '-r', '/tmp/tmp.2Qoq6J4acW/letsencrypt-auto-requirements.txt']
Traceback (most recent call last):
File "/tmp/tmp.2Qoq6J4acW/peep.py", line 967, in
exit(main())
File "/tmp/tmp.2Qoq6J4acW/peep.py", line 939, in main
return commandsargv[1]
File "/tmp/tmp.2Qoq6J4acW/peep.py", line 884, in peep_install
req.install()
File "/tmp/tmp.2Qoq6J4acW/peep.py", line 652, in install
run_pip(['install'] + other_args + ['--no-deps', '-U', archive_path])
File "/tmp/tmp.2Qoq6J4acW/peep.py", line 206, in run_pip
status_code = pip.main(initial_args)
File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/pip/init.py", line 185, in main
return command.main(cmd_args)
File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/pip/basecommand.py", line 161, in main
text = '
'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 79: ordinal not in range(128)

@erikrose
Copy link
Owner

erikrose commented Mar 3, 2016

Here's an idea: let's not show our little error-report form for PipExceptions. That way, anything that's pip's fault will bubble up, but we'll still get errors that happen from outside run_pip().

@erikrose
Copy link
Owner

erikrose commented Mar 3, 2016

Actually, from my reading of the code, that's what should be happening already: main() should be catching the PipException and returning an int, which the toplevel should unceremoniously exit with as a status code. I'm not sure why it's not.

@erikrose
Copy link
Owner

erikrose commented Mar 3, 2016

Oh, I see now. run_pip() needs to wrap its call to pip.main() in a try.

@erikrose
Copy link
Owner

erikrose commented Mar 3, 2016

Also, we should exempt main()'s call to pip.main() from error trapping as well.

@edmorley
Copy link
Contributor Author

Closing this out to de-clutter my GitHub open issues dashboard since peep is deprecated in favour of pip v8+.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants