fixed a crash occuring on logpoint

This commit is contained in:
piair 2021-12-29 10:54:25 +01:00
parent 4094081c33
commit de4e4b4e01
1 changed files with 8 additions and 6 deletions

14
V4.py
View File

@ -116,9 +116,11 @@ def ListTabs(Mdriver = None ):
return(tabs) return(tabs)
def LogError(message,log = Log, Mdriver = None): def LogError(message,log = Log, Mobdriver = None):
if Mdriver : if Mobdriver :
driver = Mdriver gdriver = Mobdriver
else :
gdriver = driver
if not IsLinux : if not IsLinux :
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
@ -126,10 +128,10 @@ def LogError(message,log = Log, Mdriver = None):
else : else :
with open('page.html', 'w') as f: with open('page.html', 'w') as f:
f.write(driver.page_source) f.write(gdriver.page_source)
driver.save_screenshot("screenshot.png") gdriver.save_screenshot("screenshot.png")
asyncio.set_event_loop(asyncio.new_event_loop()) asyncio.set_event_loop(asyncio.new_event_loop())
client = discord.Client() client = discord.Client()
@ -140,7 +142,7 @@ def LogError(message,log = Log, Mdriver = None):
channel = client.get_channel(833275838837030912) #channel de log channel = client.get_channel(833275838837030912) #channel de log
await channel.send("------------------------------------\n" + _mail) await channel.send("------------------------------------\n" + _mail)
await channel.send(ListTabs(Mdriver=Mdriver)) await channel.send(ListTabs(Mdriver=Mobdriver))
await channel.send(str(message)) await channel.send(str(message))
CustomSleep(1) CustomSleep(1)
await channel.send(file=discord.File('screenshot.png')) await channel.send(file=discord.File('screenshot.png'))