twVolc / PyCamPermanent

Permanent PiCam (SO2) installation project software
GNU General Public License v3.0
1 stars 2 forks source link

Config files generated from processing can't be reloaded in #78

Closed twVolc closed 8 months ago

twVolc commented 8 months ago

I get the following error when trying to load in a config file that was generated at the end of processing:

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Users\gg1tcw\.conda\envs\pycam\lib\tkinter\__init__.py", line 1892, in __call__
    return self.func(*args)
  File "C:\Users\gg1tcw\Documents\PythonProjects\PyCamPermanent\pycam\gui\menu.py", line 783, in load_config_file
    self.reload_config()
  File "C:\Users\gg1tcw\Documents\PythonProjects\PyCamPermanent\pycam\gui\menu.py", line 790, in reload_config
    self.reload_all()
  File "C:\Users\gg1tcw\Documents\PythonProjects\PyCamPermanent\pycam\gui\menu.py", line 767, in reload_all
    self.load_all()
  File "C:\Users\gg1tcw\Documents\PythonProjects\PyCamPermanent\pycam\gui\menu.py", line 757, in load_all
    self.set_all_pcs_lines()
  File "C:\Users\gg1tcw\Documents\PythonProjects\PyCamPermanent\pycam\gui\menu.py", line 645, in set_all_pcs_lines
    self.load_pcs(filename=line, new_line=True)
  File "C:\Users\gg1tcw\Documents\PythonProjects\PyCamPermanent\pycam\gui\menu.py", line 618, in load_pcs
    self.pyplis_worker.fig_tau.add_pcs_line(line, line_num=line_num, force_add=True)
  File "C:\Users\gg1tcw\Documents\PythonProjects\PyCamPermanent\pycam\gui\figures_analysis.py", line 695, in add_pcs_line
    line.line_id = lbl
AttributeError: 'NoneType' object has no attribute 'line_id'

It looks like this is related to back/forward slashes. The PCS lines in the config file are saved as:

- E:/Reventador/2022-04-24/Seq_3\Processed_4\pcs_line_1.txt

note the 2 backslashes (after Seq3 and Processed_4).

I edited this to

- E:/Reventador/2022-04-24/Seq_3/Processed_4\pcs_line_1.txt

And it loads in fine. So it looks like the program is able to deal with a separator of "/" or "\" prior to the filename, but that all directory separators need to be consistently the same. For some reason on saving the final data (presumably due to the fact that the program itself creates the "Processed_x" directory so adds the separator itself) separators get muddled and the file path isn't readable.

Probably the easiest solution (rather than ensuring consistency in writing pathnames), is to make sure reading the paths can deal with either separator simultaneously? Or maybe that's more convouted than just changing the separator used when generating the new Processed directory.

twVolc commented 8 months ago

Ok I'm now not sure this is the issue - I tried loading the same config again to double check and it's still throwing the error even after the edits... Going to investigate a bit further

twVolc commented 8 months ago

ohhhhhh I've been an idiot, scrap this whole issue.... I had changed the name of the processed folder, so it wasn't able to find the file because it was looking in a folder that no longer exists....