slaclab / trace

Live and Archived data plotting tool
https://slaclab.github.io/trace/
3 stars 4 forks source link

[BUG] - "input_file" Argument No Longer Works #75

Closed zdomke closed 5 days ago

zdomke commented 2 weeks ago

Describe the bug

When launching trace with an input file provided as an argument an error is thrown and the application does not launch.

Expected behavior

The application should launch using the provided input file.

Steps to Reproduce

trace -i path/to/some/file.trc

Possible solution (optional)

PathAction seems to only expect lists instead of accepting strings. Then it only returns lists. This will cause issues for the argument parser for bot the main.py and trace_file_convert.py

My platform

No response

Additional context

Includes a print(filename) in FileIOMixin.import_save_file()

zdomke@lcls-dev3:trace$ pydm trace/main.py -i trace/tests/test_data/test_file.trc 
[2024-10-25 11:15:06,345] [INFO    ] - Using PyDM via SSH. Reverting to Software Rendering.
[PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/t'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/r'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/a'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/c'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/e'), PosixPath('/'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/t'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/e'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/s'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/t'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/s'), PosixPath('/'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/t'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/e'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/s'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/t'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/_'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/d'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/a'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/t'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/a'), PosixPath('/'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/t'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/e'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/s'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/t'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/_'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/f'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/i'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/l'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/e'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/t'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/r'), PosixPath('/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/c')]
Traceback (most recent call last):
  File "/afs/slac/g/lcls/package/anaconda/envs/python3_rhel7_env/bin/pydm", line 8, in <module>
    sys.exit(main())
  File "/afs/slac.stanford.edu/u/cd/zdomke/workspace/pydm/pydm_launcher/main.py", line 114, in main
    app = pydm.PyDMApplication(
  File "/afs/slac.stanford.edu/u/cd/zdomke/workspace/pydm/pydm/application.py", line 122, in __init__
    self.main_window.open(ui_file, macros, command_line_args)
  File "/afs/slac.stanford.edu/u/cd/zdomke/workspace/pydm/pydm/main_window.py", line 385, in open
    new_widget = load_file(filename, macros=macros, args=args, target=target)
  File "/afs/slac.stanford.edu/u/cd/zdomke/workspace/pydm/pydm/display.py", line 69, in load_file
    loaded_display = loader(file, args=args, macros=macros)
  File "/afs/slac.stanford.edu/u/cd/zdomke/workspace/pydm/pydm/display.py", line 291, in load_py_file
    instance = cls(**kwargs)
  File "/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/trace/main.py", line 58, in __init__
    self.import_save_file(input_file)
  File "/afs/slac.stanford.edu/u/cd/zdomke/workspace/trace/trace/trace/mixins/file_io.py", line 52, in import_save_file
    file_name = Path(file_name)
  File "/afs/slac/g/lcls/package/anaconda/envs/python3_rhel7_env/lib/python3.10/pathlib.py", line 960, in __new__
    self = cls._from_parts(args)
  File "/afs/slac/g/lcls/package/anaconda/envs/python3_rhel7_env/lib/python3.10/pathlib.py", line 594, in _from_parts
    drv, root, parts = self._parse_args(args)
  File "/afs/slac/g/lcls/package/anaconda/envs/python3_rhel7_env/lib/python3.10/pathlib.py", line 578, in _parse_args
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not list
zdomke commented 5 days ago

Solved with PR #79