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

Multiple calls to `pip.main()` produce duplicate output #1618

Closed
wolever opened this Issue Mar 4, 2014 · 1 comment

Comments

Projects
None yet
3 participants
@wolever

wolever commented Mar 4, 2014

For example:

>>> import pip
>>> pip.main(['install'])
You must give at least one requirement to install (see "pip help install")
0
>>> pip.main(['install'])
You must give at least one requirement to install (see "pip help install")
You must give at least one requirement to install (see "pip help install")
0
>>> pip.main(['install'])
You must give at least one requirement to install (see "pip help install")
You must give at least one requirement to install (see "pip help install")
You must give at least one requirement to install (see "pip help install")
0
>>> pip.main(['install'])
You must give at least one requirement to install (see "pip help install")
You must give at least one requirement to install (see "pip help install")
You must give at least one requirement to install (see "pip help install")
You must give at least one requirement to install (see "pip help install")
0
>>> pip.main(['install'])
You must give at least one requirement to install (see "pip help install")
You must give at least one requirement to install (see "pip help install")
You must give at least one requirement to install (see "pip help install")
You must give at least one requirement to install (see "pip help install")
You must give at least one requirement to install (see "pip help install")
0

Pip version: pip 1.6.dev1

@grzn

This comment has been minimized.

Show comment
Hide comment
@grzn

grzn Apr 15, 2014

Contributor

the logger consumers are being configured over and over again every time. not sure if the maintainers would accept to reset them on main; in case you need to run pip this way, here's a workaround:

import pip

print('first')
pip.main(['install'])
print('second')
pip.main(['install'])  # problem exists
pip.logger.consumers = []
print('third')
pip.main(['install']) # problem no longer exists

this outputs:

first
You must give at least one requirement to install (see "pip help install")
second
You must give at least one requirement to install (see "pip help install")
You must give at least one requirement to install (see "pip help install")
third
You must give at least one requirement to install (see "pip help install")
Contributor

grzn commented Apr 15, 2014

the logger consumers are being configured over and over again every time. not sure if the maintainers would accept to reset them on main; in case you need to run pip this way, here's a workaround:

import pip

print('first')
pip.main(['install'])
print('second')
pip.main(['install'])  # problem exists
pip.logger.consumers = []
print('third')
pip.main(['install']) # problem no longer exists

this outputs:

first
You must give at least one requirement to install (see "pip help install")
second
You must give at least one requirement to install (see "pip help install")
You must give at least one requirement to install (see "pip help install")
third
You must give at least one requirement to install (see "pip help install")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment