ncssar / radiolog

SAR radio log program
Other
13 stars 3 forks source link

introduced in 3.10.2: operators file copy operation causes crash if no operators file exists #724

Closed caver456 closed 6 months ago

caver456 commented 6 months ago

Introduced by this clause in MainWindow.init, added Nov 9 (just before 3.10.2):

        # 662 added for debugging - copy the operator file into the run dir on startup and on shutdown
        shutil.copy(os.path.join(self.configDir,self.operatorsFileName),os.path.join(self.sessionDir,'operators_at_startup.json'))

Which causes this fatal error on startup, if no operators file exists, which would only be the case when the previous run was on a version earlier than 3.5.0 (Dec 31, 2022) which is the version where operator login was first introduced (#579).

...
211628:Initial entry: Radio Log Begins: Wed Dec 27, 2023
Uncaught exception
Traceback (most recent call last):
  File "radiolog.py", line 10117, in <module>
  File "radiolog.py", line 10110, in main
  File "radiolog.py", line 1088, in __init__
  File "shutil.py", line 417, in copy
  File "shutil.py", line 254, in copyfile
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\kathi\\RadioLog\\.config\\radiolog_operators.json'

So - extremely rare that this would show up, but, it should be fixed.

caver456 commented 6 months ago

Also need to apply this same conditional when file is copied at shutdown, near the end of MainWindow.closeEvent.