default to http, open chrome automatically2

This commit is contained in:
wataru 2023-01-17 08:25:07 +09:00
parent ed246b65d2
commit 9b4a67ac66

View File

@ -190,13 +190,18 @@ if __name__ == '__main__':
if args.openWindow: if args.openWindow:
printMessage(f"ブラウザ(Chroem)の起動を試みています。", level=2) printMessage(f"ブラウザ(Chroem)の起動を試みています。", level=2)
try: try:
webbrowser.get('chrome') webbrowser.get('google-chrome')
webbrowser.get('chrome').open(f"http://localhost:{PORT}/{path}", new=1, autoraise=True) webbrowser.get('google-chrome').open(f"http://localhost:{PORT}/{path}", new=1, autoraise=True)
except Exception as e: except Exception as e:
printMessage(f"{e}", level=1) printMessage(f"!!! {e}", level=2)
printMessage(f"ブラウザの起動に失敗しました。", level=2) try:
printMessage(f"手動でブラウザを立ち上げて表示されたURLにアクセスしてください。", level=2) webbrowser.get("C:\Program Files\Google\Chrome\Application\chrome.exe")
print() webbrowser.get("C:\Program Files\Google\Chrome\Application\chrome.exe").open(f"http://localhost:{PORT}/{path}", new=1, autoraise=True)
except Exception as e:
printMessage(f"{e}", level=1)
printMessage(f"ブラウザの起動に失敗しました。", level=2)
printMessage(f"手動でブラウザを立ち上げて表示されたURLにアクセスしてください。", level=2)
print()
# printMessage(f"http://{hostname}:{PORT}/{path}", level=1) # printMessage(f"http://{hostname}:{PORT}/{path}", level=1)
# サーバ起動 # サーバ起動