ncssar / radiolog

SAR radio log program
Other
13 stars 3 forks source link

backup rotation script: OSError: [WinError 87] the parameter is incorrect #650

Closed caver456 closed 1 year ago

caver456 commented 1 year ago

Looks like maybe an extra blank argument is appearing at the beginning of the subprocess call? Maybe introduced by recent work on #643 or similar? It affects every call to backup rotation.

130658:Invoking backup rotation script (with arguments): ['', 'C:\\Users\\NCSSAR\\RadioLog\\Chalk_Bluff_2023_05_21_081803\\Chalk_Bluff_2023_05_21_081803.csv', 'C:\\Users\\NCSSAR\\RadioLog\\Chalk_Bluff_2023_05_21_081803\\Chalk_Bluff_2023_05_21_081803_clueLog.csv', 'C:\\Users\\NCSSAR\\RadioLog\\Chalk_Bluff_2023_05_21_081803\\radiolog_fleetsync.csv', 'X:\\Chalk_Bluff_2023_05_21_081803.csv', 'X:\\Chalk_Bluff_2023_05_21_081803_clueLog.csv', 'X:\\radiolog_fleetsync.csv']
Uncaught exception
Traceback (most recent call last):
  File "radiolog.py", line 6210, in accept
  File "radiolog.py", line 1539, in rotateCsvBackups
  File "subprocess.py", line 971, in __init__
  File "subprocess.py", line 1440, in _execute_child
OSError: [WinError 87] The parameter is incorrect
caver456 commented 1 year ago

That arg list is six filenames - radiolog, cluelog, fleetsync from dir 1, then again from dir 2.

Here's the expected arg list, which shows up at home - several arguments prior to the six filenames:

053956:Invoking backup rotation script (with arguments): ['powershell.exe', '-ExecutionPolicy', 'Bypass', '-File', 'C:\\Users\\caver\\Documents\\GitHub\\radiolog\\rotateCsvBackups.ps1', '-filenames', 'C:\\Users\\caver\\RadioLog\\New_Incident_2023_06_04_053936\\New_Incident_2023_06_04_053936.csv', 'C:\\Users\\caver\\RadioLog\\New_Incident_2023_06_04_053936\\New_Incident_2023_06_04_053936_clueLog.csv', 'C:\\Users\\caver\\RadioLog\\New_Incident_2023_06_04_053936\\New_Incident_2023_06_04_053936_fleetsync.csv', 'C:\\Users\\caver\\RadioLog-2WD\\New_Incident_2023_06_04_053936.csv', 'C:\\Users\\caver\\RadioLog-2WD\\New_Incident_2023_06_04_053936_clueLog.csv', 'C:\\Users\\caver\\RadioLog-2WD\\New_Incident_2023_06_04_053936_fleetsync.csv']

Looking in the code, 'rotateScript' in the config file, which is used as the first arguments of the rotate arg list, can overwrite the default set in radiolog.py. Check the local config file... Guessing it's set to an empty string there (it doesn't exist in config_default/radiolog.cfg) as a previous attempt to keep the rotate script from causing a more onerous error or such.

caver456 commented 1 year ago

See #651: if this error happens during a clue dialog acceptance, the clue dialog will be left open; a second call to closeEvent will cause childDialogs to get out of sync. So - make sure an error in the backup rotation script passes gracefully and allows newEntryWidget.closeEvent to proceed.

caver456 commented 1 year ago

changed priority to High since #651 shows that this does actually have bad downstream effects.