Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@asfaltboy
Created September 15, 2018 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asfaltboy/cf80333a2e2a46bee6e7f8333a6dca26 to your computer and use it in GitHub Desktop.
Save asfaltboy/cf80333a2e2a46bee6e7f8333a6dca26 to your computer and use it in GitHub Desktop.
python-dotenv run continuous output issue 137 (https://github.com/theskumar/python-dotenv/issues/137)
$ python test.py
Starting running with handlers [<StreamHandler <stderr> (NOTSET)>, <StreamHandler <stdout> (NOTSET)>]
ERROR:root:Test log
Test log
ERROR:root:Test log
Test log
^CTraceback (most recent call last):
File "test.py", line 13, in <module>
time.sleep(1)
KeyboardInterrupt
$ dotenv run python test.py
^C
Aborted!
import logging
import sys
import time
logging.basicConfig() # set default stderr handler
log = logging.getLogger()
stdout_handler = logging.StreamHandler(sys.stdout)
log.addHandler(stdout_handler)
print('Starting running with handlers', log.handlers)
while True:
log.error('Test log')
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment