Pipenv: Allow option to suppress info messages that are sent to stderr

Created on 13 Mar 2018  Â·  7Comments  Â·  Source: pypa/pipenv

As per https://github.com/pypa/pipenv/issues/628 and https://github.com/pypa/pipenv/pull/630, some output, e.g. courtesy notices and messages like

Loading .env environment variables…

are sent to stderr instead of stdout. This is somewhat unexpected behaviour as these are clearly not error messages. In fact, these messages are polluting some of our error logs. It would be really useful to have an option to completely suppress these messages, e.g. by allowing the --bare flag for the run and shell commands.

All 7 comments

disagree :)

I would like to see this feature as well. This output is currently making my deploy scripts look really ugly :-)

Yes, me too, it's really annoying as my cronjobs are always mailing me now, just because of this and grep -v ing it seems a bit ugly to me

Just FIY, if you want to patch this locally, all you have to do is change this line, setting err=False

@kennethreitz is there any mechanism to either suppress this message or redirect it to stdout? a lot of unix tools (cron, most importantly) interpret any output to stderr as an actual error, meaning anything running with pipenv will be interpreted as having errored out

redirect them

Sent from my iPhone

On Jan 24, 2020, at 1:04 PM, Vlad notifications@github.com wrote:


@kennethreitz is there any mechanism to either suppress this message or redirect it to stdout? a lot of unix tools (cron, most importantly) interpret any output to stderr as an actual error, meaning anything running with pipenv will be interpreted as having errored out

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

redirect them
…
Sent from my iPhone
On Jan 24, 2020, at 1:04 PM, Vlad @.*> wrote:  @kennethreitz is there any mechanism to either suppress this message or redirect it to stdout? a lot of unix tools (cron, most importantly) interpret any output to stderr as an actual error, meaning anything running with pipenv will be interpreted as having errored out — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

i don't want to redirect all of my stderr though, just this one message; one can do what @sudeshjethoe suggested and pipe stderr into grep -v then pipe the stdout of that back to stderr, all the while redirecting stdout to null, but it seems like a really convoluted (and limiting) solution for removing a non-critical message from stderr

for anyone else looking to do this, here's my current solution:

# pipenv run python script.py 2> >(grep -v "Loading .env environment variables" 1>&2)

which I found courtesy of this SO answer https://stackoverflow.com/a/15936384/912015

Was this page helpful?
0 / 5 - 0 ratings

Related issues

erinxocon picture erinxocon  Â·  3Comments

AkiraSama picture AkiraSama  Â·  3Comments

fbender picture fbender  Â·  3Comments

FooBarQuaxx picture FooBarQuaxx  Â·  3Comments

ansrivas picture ansrivas  Â·  3Comments