question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow preventing or suppressing UserWarning

See original GitHub issue

We use dotenv on our project/wsgi.py and project/celery.py for local development where we do have a .env. When we deploy to Heroku our logs get polluted with UserWarnings.

Workaround is to do the following:

with warnings.catch_warnings():
    warnings.simplefilter('ignore')
    dotenv.read_dotenv()

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:5
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dhrpcommented, Jun 18, 2017

I know this thread has been dead, but we’d like the suppress mode, and as far as I can tell it is not solved.

1reaction
jpadillacommented, Jun 17, 2016

@chris-erickson this is a suggestion on how to suppress it in your app. We could provide an option like dotenv.read_dotenv(silent=True) and skip the warning. Pull requests are welcome.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to disable Python warnings? - Stack Overflow
Look at the Temporarily Suppressing Warnings section of the Python docs: If you are using code that you know will raise a warning,...
Read more >
warnings — Warning control — Python 3.11.1 documentation
Temporarily Suppressing Warnings¶ ... While within the context manager all warnings will simply be ignored. This allows you to use known-deprecated code without ......
Read more >
Suppress Warnings In Python: All You Need To Know
Suppress warnings in python; warnings and types, ignore all warnings, ignore specific warnings, re-enable warnings.
Read more >
Disable UserWarning s triggered by dependencies #1737
I think UserWarnings that are triggered by Haystack's or the user's code should stay visible, but those coming from dependencies could be hidden ......
Read more >
Control (ignore/display) warnings in Python - nkmk note
If you want to stop the process for warnings like exceptions, set action of warnings.simplefilter() to 'error' . warnings.resetwarnings() ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found