Project

General

Profile

Actions

Bug #10170

closed

Debug commands raise when no debug.log exists

Added by Martin Cooper about 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
12/10/2022
Due date:
% Done:

100%

Estimated time:
Chirp Version:
next (py3)
Model affected:
(All models)
Platform:
MacOS
Debug Log:
I read the instructions above:

Description

In a default user scenario on Mac, no debug.log file is created here:

https://github.com/kk7ds/chirp/blob/py3/chirp/logger.py#L89

unless CHIRP_DEBUG_LOG has been set in the environment.

The debug-related menu items here:

https://github.com/kk7ds/chirp/blob/py3/chirp/wxui/main.py#L1107
https://github.com/kk7ds/chirp/blob/py3/chirp/wxui/main.py#L1117

do not check for the existence of debug.log before attempting to copy it using shutil.copy() , leading to, for example:

ERROR: <function ChirpMain._menu_debug_loc at 0x113e09620> raised unexpected exception
Traceback (most recent call last):
  File "/Users/martinc/dev/src/github/chirp/chirp/wxui/common.py", line 408, in run_safe
    return fn(*args, **kwargs)
  File "/Users/martinc/dev/src/github/chirp/chirp/wxui/main.py", line 1123, in _menu_debug_loc
    shutil.copy(src, dst)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/shutil.py", line 241, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/shutil.py", line 120, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/martinc/.chirp/debug.log'

I'm filing a ticket rather than a PR, since it's unclear to me as to the best way to address this.

Actions

Also available in: Atom PDF