jetperch / pyjoulescope_ui

Joulescope graphical user interface
https://www.joulescope.com
Apache License 2.0
87 stars 26 forks source link

Turning off logging prevents Windows distribution from launching #120

Closed mliberty1 closed 3 years ago

mliberty1 commented 3 years ago

Platform: Win 10 x64 Version: 0.9.3 released (works fine unreleased)

Description If you turn off logging, File → Preferences → General → log_level → OFF, then close and relaunch the Joulescope UI, it does not start. It displays:

--------------------
Exception on Joulescope UI 0.9.5 startup. 
Python=3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, 13:44:55) [MSC v.1928 64 bit (AMD64)]
Platform=Windows-10-10.0.19041-SP0
Traceback (most recent call last):
  File "joulescope_ui\main.py", line 1877, in run
  File "joulescope_ui\logging_util.py", line 167, in logging_config
AttributeError: 'NullWriter' object has no attribute 'fileno'

Expected Behavior You should be able to turn off logging and have the Joulescope UI run.

mliberty1 commented 3 years ago

The cause of the failure is here.  It looks like you turned off the Joulescope UI logging, which I suspect most people never touch.  The faulthandler.enable function attempts to use stderr by default.  This works fine in development and for every other platform.  In the distributed version on Windows, stderr apparently does not exist, which causes this function to fail.  I successfully duplicated the issue on my Windows machine.

Workaround The workaround is to turn logging back on.  If you don't care about your other Joulescope UI settings, you can open File Explorer, type "%LOCALAPPDATA%\joulescope" into the navigation bar, like this: image

Then select all four items with your mouse, and press delete. image

You should then be able to launch the Joulescope UI and have it run.

If you do care about your settings, navigate into the config directory and open "joulescope_config.json" in your favorite text editor.  Search for "General/log_level" and edit so that they are all set to "INFO".

mliberty1 commented 3 years ago

Fixed in v0.9.7.