
What this does is, if you're running without optimization (as in python script.py) you get the DEBUG-level stuff, whereas if you run with python -OO script.py you don't. import os, logging if os.getenv('DEBUGGING'): logging.basicConfig(level logging.DEBUG) then you can just: jcomeauaspire: mkdir -p /tmp/some/random/ jcomeauaspire: echo 'import logging bug('test')' > /tmp/some/random/script.py jcomeauaspire: DEBUGGING1 python /tmp/some/random/script.

: I've since switched to a different method: logging.basicConfig(level=logging.DEBUG if _debug_ else logging.INFO) Then you can just: mkdir -p echo 'import logging bug("test")' > DEBUGGING=1 python /tmp/some/random/script.py Logging.basicConfig(level = logging.DEBUG) It is similar to pyrasite and pyringe, but supports python3, doesnt require gdb, and uses IPython for the debugger (which means pdb with colors and autocomplete).

To sum it up for future uses, if the service fails to start and youre pretty sure about your code, these are helpful actions to try and solve your issues: use sc start ServiceName, sc query ServiceName and sc stop ServiceName to get info about the service. It is a python debugger that allows you to attach to a running python program and debug it in your current terminal. USER_SITE: '/home/jcomeau/.local/lib/python2.7/site-packages' (exists)ĮNABLE_USER_SITE: mkdir -p vi ~/.local/lib/python2.7/site-packages/usercustomize.py Moving the python script in the same drive as the python installation did the job. disable-ipv6 Disable IPv6 support (enabled by default if supported), see the socket module. See the () method of the sqlite3 module. What if you wanted to add a -debug-mode or a -verbose to your python application. USER_BASE: '/home/jcomeau/.local' (exists) General Options -enable-loadable-sqlite-extensions Support loadable extensions in the sqlite extension module (default is no). If you want to enable logging.DEBUG level for a script you don't want to (or cannot) edit, you can customize your startup: python -c "import site site._script()"
