L
L
lok1012022-02-07 16:22:37
Python
lok101, 2022-02-07 16:22:37

"Extra" log data in a python script when executed via the Windows command line. Can it be removed?

When I run a script written in Python (selenium) on the command line, the system periodically floods me with log data that I do not need, such as:

spoiler

Subsequent non-fatal errors won't be logged; see https://fburl.com/debugjs.", source: <<< Это не моё.
https://www.instagram.com/static/bundles/metro/Con... <<< Это тоже.

18:12:36 - bot10 -- <Аккаунт - 1> -- Перешёл в профиль: marina_marinakan ======> СТОП-СЛОВО [29/50]

[0207/181248.326:INFO:CONSOLE(65)] "ErrorUtils caught an error: <<< Ещё это.
Cannot convert undefined or null to object <<< И вот это!


When executing a script in PyCharm, there is nothing like this and everything is clean. I do not need all this data, the script works and they only interfere with me. Can this be removed somehow?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
AVKor, 2022-02-07
@lok101

Use option
--log-level=OFF

A
Alan Gibizov, 2022-02-07
@phaggi

There are two ways to solve:

  • Redirect the output of errors, warnings and any messages somewhere past the console;
  • Disable these messages.

Here are my attempts to disable everything that is possible.
os.environ['WDM_LOG_LEVEL'] = '0'
warnings.filterwarnings("ignore", category=DeprecationWarning)
chrome_options = Options() chrome_options.add_argument('--headless')
browser = webdriver.Chrome(ChromeDriverManager(print_first_line=False).install(), options=chrome_options)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question