Error while running the eel project exe file with no console
I have converted my eel project to an executable file with console and It is running smoothly. But whenever I tries it with no console it makes an exe file but gives me error whenever I opens it. The error is below.
Traceback (most recent call last):
File "main.py", line 1, in
Plese help me with it...
same issue +1
same issue +1
Eel is importing a bottle, but AttributeError cannot be caught in bottle.py
https://docs.python.org/3.11/library/sys.html?highlight=sys#module-sys
It is written as below.
Note Under some conditions stdin, stdout and stderr as well as the original values __stdin__, __stdout__ and __stderr__ can be None. It is usually the case for Windows GUI apps that aren’t connected to a console and Python apps started with pythonw.
There is also a way to edit bottle.py directly, but I assign null to stdout and stderr and throw it away.
import os
import sys
sys.stdout = open(os.devnull, 'w')
sys.stderr = open(os.devnull, 'w')
import eel
Sorry, Generated by translation
related issue #654, #698
Eel is importing a bottle, but AttributeError cannot be caught in bottle.py
https://docs.python.org/3.11/library/sys.html?highlight=sys#module-sys
It is written as below.
Note Under some conditions stdin, stdout and stderr as well as the original values __stdin__, __stdout__ and __stderr__ can be None. It is usually the case for Windows GUI apps that aren’t connected to a console and Python apps started with pythonw.There is also a way to edit bottle.py directly, but I assign null to stdout and stderr and throw it away.
import os import sys sys.stdout = open(os.devnull, 'w') sys.stderr = open(os.devnull, 'w') import eelSorry, Generated by translation
definitely works, much obliged.
Thanks for the workaround, You're not less than Hacker 🧑💻😁