[英]Is there a way to hide Windows logs when executing a Python script?
我面臨一個我根本不明白為什么會發生的問題。
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似乎是關於 USB 設備問題的消息。
以下是 window 上發生的情況的片段:
PS F:\Scripts\ShoPyBot> python .\script.py
DumbScript v1.0~RC15
Escribe la URL del siito web (sin incluir 'https://'):
直到這里一切都按預期進行,但是在:之后(當腳本要求用戶輸入時),window 被淹沒,如下所示:
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.
我不認為問題在於通過外部驅動器執行腳本,因為有時,從我的 PC 的內部 SSD 驅動器執行腳本也會引發類似的消息(盡管它們不經常出現)。
我在腳本上使用的模塊是selenium, requests, os, json, sys, time, tld and discord_webhook
,如果它們與問題有關。
提前致謝。
編輯:忘了補充說我也使用模塊os
。
這些來自 Chromium 瀏覽器,這是 selenium 使用的。 Chrome 將自己視為一個完整的操作系統,因此它試圖枚舉您的所有 USB 設備,包括那些掛起的設備。 這會導致此警告。 他們計划更改日志記錄以默認隱藏這些,但尚未完成。
這里有一個類似的問題: https://forum.yazbel.com/t/selenium-failed-to-read-descriptor-from-node-connection-hatasi/10216
如果翻譯它會告訴你他們發現它可以在 Firefox 上工作,
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.