Hi folks, I ran into this old issue just today -- and looking at the docs, I see:
https://pyinstaller.org/en/stable/common-issues-and-pitfalls.html?highlight=os.devnull#sys-stdin-sys-stdout-and-sys-stderr-in-noconsole-windowed-applications-windows-only So I have my solution. But is it possible that PyInstaller could do it by default for Windows apps? Thanks, -CHB On Wed, Apr 26, 2023 at 12:16 PM Steve Barnes <[email protected]> wrote: > Eric, > > > > Good Idea & done with the os.devnull solution! > > > > Steve > > > > *From:* [email protected] <[email protected]> *On > Behalf Of *Eric Fahlgren > *Sent:* Wednesday, April 26, 2023 3:09 PM > *To:* [email protected] > *Subject:* Re: [PyInstaller] ValueError: Unable to configure formatter > 'default' > > > > Steve, > > > > That seems common and broad enough that you should consider adding a wiki > page for it... > > https://github.com/pyinstaller/pyinstaller/wiki/Recipes > > > > Eric > > > > On Tue, Apr 25, 2023 at 10:42 PM Steve Barnes <[email protected]> > wrote: > > Hi Alisha, > > > > I have seen this problem before and eventually figured out the cause. You > are directly *or indirectly* using either stdout or stderr as an out put > for logger *but* pyinstaller and some or most exe builders produce exes > which, *when running in Windowed mode,* set both of these to None and > logger fails like this because None *as the exception says *doesn’t have > an istty *or any other *methods. > > > > Some possible solutions include: > > - Set the application to be a console application so that it will open > a terminal window (it can still use the GUI but log messages will go to the > terminal *quick but dirty* > - If the application has the frozen attribute or set sys.stdout is > None and no log file is specified then create your logger with the file set > to os.devnull *this will discard all logs* > - Use logging.NullHandler > <https://docs.python.org/3/library/logging.handlers.html#nullhandler> > if frozen or sys.stdout is None. > - Always log to a file but please consider using > logging.RotatingFileHandler > > <https://docs.python.org/3/library/logging.handlers.html#rotatingfilehandler> > as the default handler if frozen or sys.stdout is None. > > > > Hope that this helps. > > > > Steve > > > > *From:* [email protected] <[email protected]> *On > Behalf Of *Alisha Jain > *Sent:* Monday, April 24, 2023 5:14 PM > *To:* PyInstaller <[email protected]> > *Subject:* [PyInstaller] ValueError: Unable to configure formatter > 'default' > > > > Hi, > > > > I creating a python application which uses uvicorn module. The code runs > successfully, however, when I create a exe using pyinstaller, It is able to > create the executable but I see following error when I run the exe file. > Please help. > > > > > -- > You received this message because you are subscribed to the Google Groups > "PyInstaller" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/pyinstaller/4ff86e8c-5ccb-48c4-a608-c5495c92ad35n%40googlegroups.com > <https://groups.google.com/d/msgid/pyinstaller/4ff86e8c-5ccb-48c4-a608-c5495c92ad35n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > -- > You received this message because you are subscribed to the Google Groups > "PyInstaller" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/pyinstaller/DU0P194MB18196E90634DD627C520F6D29B659%40DU0P194MB1819.EURP194.PROD.OUTLOOK.COM > <https://groups.google.com/d/msgid/pyinstaller/DU0P194MB18196E90634DD627C520F6D29B659%40DU0P194MB1819.EURP194.PROD.OUTLOOK.COM?utm_medium=email&utm_source=footer> > . > > -- > You received this message because you are subscribed to the Google Groups > "PyInstaller" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/pyinstaller/CAP2Qz%2BXLubZckCgfL_aJriL1yu3fd4p%2Bn1P0VRPOXESNLeA-RA%40mail.gmail.com > <https://groups.google.com/d/msgid/pyinstaller/CAP2Qz%2BXLubZckCgfL_aJriL1yu3fd4p%2Bn1P0VRPOXESNLeA-RA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > -- > You received this message because you are subscribed to the Google Groups > "PyInstaller" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/pyinstaller/DU0P194MB18199CB7A26C857CAF04E9B99B659%40DU0P194MB1819.EURP194.PROD.OUTLOOK.COM > <https://groups.google.com/d/msgid/pyinstaller/DU0P194MB18199CB7A26C857CAF04E9B99B659%40DU0P194MB1819.EURP194.PROD.OUTLOOK.COM?utm_medium=email&utm_source=footer> > . > -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [email protected] -- You received this message because you are subscribed to the Google Groups "PyInstaller" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/CALGmxEJ748UR2UsVG%2BKf_ufNhd8wD68mqcHhE1%2BtqhYn5mws_g%40mail.gmail.com.
