Hi Chris, The python standard library os.devnull gives an operating system independent equivalent to /dev/null (IIRC it actually maps to /dev/null on *nix systems) – including MS Windows.
I have suggested in the past that python exe generators could/should set both stdout and stderr to os.devnull for windowed exes rather than using None in that case. All the best, Steve Barnes From: 'Chris Barker - NOAA Federal' via PyInstaller <pyinstaller@googlegroups.com> Sent: Wednesday, April 26, 2023 3:07 PM To: pyinstaller@googlegroups.com Subject: Re: [PyInstaller] ValueError: Unable to configure formatter 'default' Hmm, Seems this is a bug / missing feature in PyIntaller. Writing to stdout/err is pretty common dnd can be done down in the stack of libraries, so not always in full control of the application author. Is there a /dev/null equiv on Windows? Or a “hidden” console that can be written to (I think that’s what Mac GUI apps use — you can open the “console” app and see output.) Or a dummy file object in the stdlib that could be used? -CHB Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959<tel:(206)%20526-6959> voice 7600 Sand Point Way NE (206) 526-6329<tel:(206)%20526-6329> fax Seattle, WA 98115<x-apple-data-detectors://6/1> (206) 526-6317<tel:(206)%20526-6317> main reception On Apr 25, 2023, at 11:42 PM, Steve Barnes <gadgetst...@live.co.uk<mailto:gadgetst...@live.co.uk>> 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: 1. 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 2. 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 3. Use logging.NullHandler<https://docs.python.org/3/library/logging.handlers.html#nullhandler> if frozen or sys.stdout is None. 4. 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: pyinstaller@googlegroups.com<mailto:pyinstaller@googlegroups.com> <pyinstaller@googlegroups.com<mailto:pyinstaller@googlegroups.com>> On Behalf Of Alisha Jain Sent: Monday, April 24, 2023 5:14 PM To: PyInstaller <pyinstaller@googlegroups.com<mailto:pyinstaller@googlegroups.com>> 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. <image001.png> -- 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 pyinstaller+unsubscr...@googlegroups.com<mailto:pyinstaller+unsubscr...@googlegroups.com>. 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 pyinstaller+unsubscr...@googlegroups.com<mailto:pyinstaller+unsubscr...@googlegroups.com>. 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 pyinstaller+unsubscr...@googlegroups.com<mailto:pyinstaller+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/931E8665-50B5-4BAC-A4E6-09C5A5F02546%40noaa.gov<https://groups.google.com/d/msgid/pyinstaller/931E8665-50B5-4BAC-A4E6-09C5A5F02546%40noaa.gov?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 pyinstaller+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/DU0P194MB1819E5C819DFE2C927BA7CDB9B659%40DU0P194MB1819.EURP194.PROD.OUTLOOK.COM.