Terry J. Reedy added the comment:

On python-list, Chris Angelico reported 2 other problems when running something 
like "import pip; pip.main(['install','psycopg2'])" from IDLE.  Both can be 
worked around in a pipgui program.

1. pip displays a progress bar by sending to stdout a sequence of strings 
something like '#', '\r##', '\r###', ..., '\r###...###'.  When IDLE sends these 
on to the tk text widget, they are displayed as above.  '\r' displays as '\r' 
and does not cause a 'return'.

pipgui would already be monitoring and parsing pip output to display 
information in appropriate widgets, so it could look for and interpret whatever 
pip actually does send.

2. pip has a bug.  When installing a non-wheel, it may unconditionally execute 
"s.decode(sys.__stdout__.encoding)".  sys.__stdin__, etcetera, are documented 
as sometimes being None, 
https://docs.python.org/3/library/sys.html#sys.__stdin__, and None does not 
have an 'encoding' attribute.  The workaround, until this is fixed, is for 
pipgui to rebind sys.__stdout__ to an object that at least has a sensible 
.encoding.  I would grep the entire pip source other '__std.*__' uses to see if 
more is needed.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23551>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to