ipython: Unexpected logging outputs after setting log level to debug.

I got unexcepted outputs to console after set log level to debug while using tab to autocomplete, and it breaks my typing. Here’s my screenshot: ipython-logging

Reproduce:

In [1]: import logging

In [2]: logging.getLogger().setLevel(logging.DEBUG)

In [3]: logging.info("xxxx")
INFO:root:xxxx

In [4]: logging.<TAB>DEBUG:parso.python.diff:diff parser start
DEBUG:parso.python.diff:diff parser calculated
DEBUG:parso.python.diff:diff: line_lengths old: 1, new: 1
DEBUG:parso.python.diff:diff replace old[1:1] new[1:1]
DEBUG:parso.python.diff:parse_part from 1 to 1 (to 0 in part parser)
DEBUG:parso.python.diff:diff parser end
DEBUG:parso.cache:pickle loaded: /Users/uushuo/.pyenv/versions/3.6.3/lib/python3.6/collections/__init__.py
DEBUG:parso.cache:pickle loaded: /Users/uushuo/.pyenv/versions/3.6.3/lib/python3.6/io.py
DEBUG:parso.cache:pickle loaded: /Users/uushuo/.pyenv/versions/3.6.3/lib/python3.6/os.py
DEBUG:parso.cache:pickle loaded: /Users/uushuo/.pyenv/versions/3.6.3/lib/python3.6/string.py
DEBUG:parso.cache:pickle loaded: /Users/uushuo/.pyenv/versions/3.6.3/lib/python3.6/threading.py
DEBUG:parso.cache:pickle loaded: /Users/uushuo/.pyenv/versions/3.6.3/lib/python3.6/traceback.py
DEBUG:parso.cache:pickle loaded: /Users/uushuo/.pyenv/versions/3.6.3/lib/python3.6/warnings.py
DEBUG:parso.cache:pickle loaded: /Users/uushuo/.pyenv/versions/3.6.3/lib/python3.6/weakref.py

Version info

{'commit_hash': 'ca5443062',
 'commit_source': 'installation',
 'default_encoding': 'UTF-8',
 'ipython_path': '/Users/uushuo/.pyenv/versions/3.6.3/envs/next/lib/python3.6/site-packages/IPython',
 'ipython_version': '6.2.1',
 'os_name': 'posix',
 'platform': 'Darwin-17.0.0-x86_64-i386-64bit',
 'sys_executable': '/Users/uushuo/.pyenv/versions/next/bin/python',
 'sys_platform': 'darwin',
 'sys_version': '3.6.3 (default, Dec 15 2017, 20:17:37) \n'
                '[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)]'}

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 43
  • Comments: 32 (2 by maintainers)

Commits related to this issue

Most upvoted comments

First of all, you should update to parso 0.1.1 in case you’re receiving this messages in ROOT level (like I did). This is related to https://github.com/davidhalter/parso/issues/9 But seems from your logs you have parso 0.1.1 already. Second, this should fix this:

logging.getLogger('parso.python.diff').disabled = True

The issue came back with ipython 7.2

As a workaround you can configure parso logger in settings.py to show only warning messages:

import logging

logging.getLogger('parso').setLevel(logging.WARNING)

I have same issue - with parso 0.1.1 and ipython 6.2.1 (django shell console)

edit: 'parso': { 'handlers': ['console'], 'level': 'INFO', 'propagate': False, }, worked for me, but it’s definitely workaround…

Still have this issue with iptyhon 7.4.0 and scrapy shell

import logging
logging.getLogger().setLevel(logging.WARNING);

works, but i cant make it work during starting of the shell. Looks like scapy don’t loads default_profile Any workarounds?

I have the same issue with ipython 6.2.1 that I just pip installed. all my python stuffs are newly installed include scrapy. but in scrapy shell .. it begin spam the DEBUG info will this be fixed?

Same problem with ipython 7.2.0 parso 0.3.4 It’s a very big problem.

It might be a good idea to just disable the parso logger in IPython altogether. I don’t really think that it is needed in any case.

When people are enabling logging, they usually want to see the logs about the stuff they import and not the stuff that IPython imports.

I have this issue on Anaconda with IPython 7.2.0. and Scrapy Shell (Scrapy’s version 1.5.1).

This should probably be part of IPython. Someone of you should just do a pull request there.

I workaround this problem by add the following line in my ipython_config.py

c.Application.log_level = logging.INFO

But I think it is only a workaround, we do not need any more configuration for fixing this flaw.

I downgraded to ipython 5.2.1 to get around this. This may not be an option for you, but it worked for me as a stopgap until this is fixed in ipython.

@Ashlett’s workaround isn’t working for me btw, neither is setting anything in the ipython config. Neither is

import logging
logger = logging.getLogger()
logger.handlers = []

when in IPython itself.

I do NOT want to change loglevel for everything, I just want to shut up parso, asyncio, blib2to3, and the list just keeps growing.

Here’s a workaround that works for me:

  1. Created a file pythonstartup.py in my home directory with this content:
import logging
 
for lib in ("asyncio", "parso"):
    logging.getLogger(lib).setLevel(logging.WARNING)
  1. Added this line to my .bashrc:
export PYTHONSTARTUP="$HOME/pythonstartup.py"

(I included asyncio because I saw some useless logs from it at the startup of Django shell_plus with IPython, you can skip it depending on your use case)

I always disable the parso log every time when I use the console for debugging, which is very inconvenient and unproductive. I think this should be fixed.

I made a PR: #14119 Please preview and approve my code.

I updated Ipython to 6.5.0 and I still have the issue with scrapy shell

This issue get resolved for me after upgrading to the latest version (6.5.0).

That users change log level in REPL SHELL is a usual thing. How about making debug settings of shell other places to avoid effecting by log level settings.

Sounds good to me, I haven’t seen it in a while, we can reopen if it reappears.

I guess this issue can be closed!

5.5.0 worked for me too