日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

closecmd python_如何在python中禁止控制台/ cmd错误消息

發布時間:2024/10/8 python 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 closecmd python_如何在python中禁止控制台/ cmd错误消息 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

如何在

python中為chromedriver和pyinstaller exe壓縮錯誤消息?

我注意到當我在pyinstaller中使用chromedriver并運行它時,我得到一個錯誤消息列表.我一直試圖刪除它們但到目前為止沒有運氣.

更新:似乎無頭旗幟引起了很多悲痛.

DevTools listening on ws://127.0.0.1:12386/devtools/browser/74743659-2c28-45fb-bab4-3836bb91f383

[1213/214223.999:ERROR:service_manager.cc(157)] Connection InterfaceProviderSpec prevented service: content_renderer from binding interface: blink::mojom::ReportingServiceProxy exposed by: content_browser

Improvement, now how to remove this in headless.

Error messages:

DevTools listening on ws://127.0.0.1:12386/devtools/browser/74743659-2c28-45fb-bab4-3836bb91f383

[1213/214223.999:ERROR:service_manager.cc(157)] Connection InterfaceProviderSpec prevented service: content_renderer from binding interface: blink::mojom::ReportingServiceProxy exposed by: content_browser

[1213/214223.999:INFO:CONSOLE(4)] "Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.", source: http://centrebet.com/Scripts/jquery-1.6.4.min.js (4)

[1213/214226.896:INFO:CONSOLE(42)] "Uncaught ReferenceError: $is not defined", source: http://centrebet.com/Sports/8320572 (42)

[1213/214226.899:INFO:CONSOLE(60)] "Uncaught ReferenceError: bs_auto_expand is not defined", source: http://centrebet.com/Sports/8320572 (60)

[1213/214226.900:INFO:CONSOLE(65)] "Uncaught ReferenceError: gaPush is not defined", source: http://centrebet.com/Sports/8320572 (65)

[1213/214227.987:INFO:CONSOLE(112)] "Uncaught ReferenceError: $is not defined", source: http://centrebet.com/Sports/71973868 (112)

[1213/214227.988:INFO:CONSOLE(174)] "Uncaught ReferenceError: addStaticBubble is not defined", source: http://centrebet.com/Sports/71973868 (174)

[1213/214227.989:INFO:CONSOLE(211)] "Uncaught ReferenceError: $is not defined", source: http://centrebet.com/Sports/71973868 (211)

[1213/214227.991:INFO:CONSOLE(431)] "Uncaught ReferenceError: addStaticBubble is not defined", source: http://centrebet.com/Sports/71973868 (431)

[1213/214227.991:INFO:CONSOLE(468)] "Uncaught ReferenceError: $is not defined", source: http://centrebet.com/Sports/71973868 (468)

[1213/214227.998:INFO:CONSOLE(688)] "Uncaught ReferenceError: addStaticBubble is not defined", source: http://centrebet.com/Sports/71973868 (688)

[1213/214227.998:INFO:CONSOLE(725)] "Uncaught ReferenceError: $is not defined", source: http://centrebet.com/Sports/71973868 (725)

[1213/214228.001:INFO:CONSOLE(945)] "Uncaught ReferenceError: addStaticBubble is not defined", source: http://centrebet.com/Sports/71973868 (945)

[1213/214228.001:INFO:CONSOLE(982)] "Uncaught ReferenceError: $is not defined", source: http://centrebet.com/Sports/71973868 (982)

[1213/214228.002:INFO:CONSOLE(1202)] "Uncaught ReferenceError: addStaticBubble is not defined", source: http://centrebet.com/Sports/71973868 (1202)

[1213/214228.003:INFO:CONSOLE(1239)] "Uncaught ReferenceError: $is not defined", source: http://centrebet.com/Sports/71973868 (1239)

[1213/214228.004:INFO:CONSOLE(1459)] "Uncaught ReferenceError: addStaticBubble is not defined", source: http://centrebet.com/Sports/71973868 (1459)

[1213/214228.004:INFO:CONSOLE(1496)] "Uncaught ReferenceError: $is not defined", source: http://centrebet.com/Sports/71973868 (1496)

[1213/214228.005:INFO:CONSOLE(1716)] "Uncaught ReferenceError: addStaticBubble is not defined", source: http://centrebet.com/Sports/71973868 (1716)

[1213/214228.005:INFO:CONSOLE(1753)] "Uncaught ReferenceError: $is not defined", source: http://centrebet.com/Sports/71973868 (1753)

[1213/214228.006:INFO:CONSOLE(1973)] "Uncaught ReferenceError: addStaticBubble is not defined", source: http://centrebet.com/Sports/71973868 (1973)

碼:

options = Options()

options.add_argument('--headless')

options.add_argument('--hide-scrollbars')

options.add_argument('--disable-gpu')

driver = webdriver.Chrome(chrome_options=options)

url = "http://centrebet.com/"

driver.get(url)

def page_counter():

for x in range(1000):

yield x

count = page_counter()

driver.get(url)

sports = driver.find_element_by_id("accordionMenu1_ulSports")

links = [url + link.get_attribute("onclick").replace("menulink('", "").replace("')", "") for link in sports.find_elements_by_xpath('//ul[@id="accordionMenu1_ulSports"]//li//ul//li//ul//li//a[starts-with(@onclick, "menulink")]')]

links = dict((next(count) + 1, e) for e in links)

desc_links = collections.OrderedDict(sorted(links.items(), reverse=True))

for key, value in desc_links.items():

driver.get(value)

我嘗試過的:

logging.disable(logging.CRITICAL)

logging.Logger.info = lambda *args, **kwargs: None

sys.stderr = os.devnull

logging.getLogger("requests").setLevel(logging.WARNING)

@contextmanager

def suppress_stdout():

with open(os.devnull, "w") as devnull:

old_stdout = sys.stdout

sys.stdout = devnull

try:

yield

finally:

sys.stdout = old_stdout

import warnings

def fxn():

warnings.warn("deprecated", DeprecationWarning)

with warnings.catch_warnings():

warnings.simplefilter("ignore")

fxn()

錯誤消息似乎循環.也許重寫可能會修復……

總結

以上是生活随笔為你收集整理的closecmd python_如何在python中禁止控制台/ cmd错误消息的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。