Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent showing debugging log info inside ipython shell

I'm using scrapy shell inside virtualenv. IPython is installed inside virtualenv. When I start scrapy shell using

 scrapy shell 'https://example.com'

and press tab for autocomplete suggestions, it shows a lot of debug information. How can I disable this?

In [1]: from scra2018-03-23 10:05:45 [parso.python.diff] DEBUG: diff parser start
2018-03-23 10:05:45 [parso.python.diff] DEBUG: diff parser calculated
2018-03-23 10:05:45 [parso.python.diff] DEBUG: diff: line_lengths old: 1, new: 1
2018-03-23 10:05:45 [parso.python.diff] DEBUG: diff replace old[1:1] new[1:1]
2018-03-23 10:05:45 [parso.python.diff] DEBUG: parse_part from 1 to 1 (to 0 in part parser)
2018-03-23 10:05:45 [parso.python.diff] DEBUG: diff parser end

enter image description here

like image 821
Arun Avatar asked Mar 23 '18 04:03

Arun


3 Answers

https://github.com/ipython/ipython/issues/10946 looks like it's reported bug here.

In case you need debug logging in ipython, try to logging.getLogger('parso.cache').disabled=True logging.getLogger('parso.cache.pickle').disabled=True

and keep wait for parso update

like image 113
Artem Baskakov Avatar answered Oct 23 '22 15:10

Artem Baskakov


Try doing this to set the logging level to WARNING:

import logging

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

Any log messages of level INFO or DEBUG shouldn't appear anymore. You can also set the log level to logging.ERROR. Then WARNING messages won't appear as well.

Good luck!

like image 9
Shuwn Yuan Tee Avatar answered Oct 23 '22 15:10

Shuwn Yuan Tee


You can use the -L command-line option to change the log level to INFO:

scrapy shell -L INFO https://example.com
like image 4
Gallaecio Avatar answered Oct 23 '22 15:10

Gallaecio