noeXzTi
noeXzTi

Reputation: 1

Is there a way to hide Windows logs when executing a Python script?

I'm facing a problem that I do not understand at all why does it happens.

I have a Python script (that requires user input) located on an external drive (1 TB, formatted with exFAT), and when I execute the file through Windows PowerShell, when my script is asking for a input, the window is suddenly flooded with messages that appears to be about problems with the USB device.

Here's a fragment of what happens on the window:

PS F:\Scripts\ShoPyBot> python .\script.py

DumbScript v1.0~RC15

Escribe la URL del siito web (sin incluir 'https://'):

Until here everything is as expected, but then, after the : (when the script asks for user input), the window is flooded like:

Escribe la URL del siito web (sin incluir 'https://'): [9928:9864:0304/220322.610:ERROR:usb_descriptors.cc(160)] Device descriptor parsing error.
n[9928:9864:0304/220328.885:ERROR:usb_descriptors.cc(160)] Device descriptor parsing error.
[9928:9864:0304/220329.158:ERROR:usb_descriptors.cc(160)] Device descriptor parsing error.
[9928:9864:0304/220329.434:ERROR:usb_descriptors.cc(160)] Device descriptor parsing error.
[9928:9864:0304/220329.715:ERROR:usb_descriptors.cc(160)] Device descriptor parsing error.
[9928:9864:0304/220329.994:ERROR:usb_descriptors.cc(160)] Device descriptor parsing error.

I do not think the issue is about executing the script through an external drive, as sometimes, executing scripts from my PC's internal SSD drive also throws messages like that (although they don't appear very often).

The modules I'm using on the script are selenium, requests, os, json, sys, time, tld and discord_webhook, if they're related to the problem.

Thanks in advance.

EDIT: forgot to add that I also use the module os.

Upvotes: 0

Views: 106

Answers (2)

Frank
Frank

Reputation: 31

There is a similar issue here: https://forum.yazbel.com/t/selenium-failed-to-read-descriptor-from-node-connection-hatasi/10216

If translated it will tell you that they found that it can work on Firefox,

Upvotes: 0

Tim Roberts
Tim Roberts

Reputation: 54757

These are coming from the Chromium browser, which is what selenium uses. Chrome thinks of itself as an entire operating system, so it's trying to enumerate all of your USB devices, including those that are suspended. That causes this warning. They plan to change the logging to hide these by default, but it hasn't been done yet.

Upvotes: 1

Related Questions