SETI / rms-pds4indextools

PDS4 index tools Python module
Apache License 2.0
0 stars 0 forks source link

pds4_create_xml_index crashes when label generated without index file #18

Closed rfrenchseti closed 1 month ago

rfrenchseti commented 2 months ago

pds4_create_xml_index.py:

When you specify --output-headers-file without --output-index-file, no index file is generated. However, if you also specify --generate-label, it will go ahead and try to generate a label without an index file to go off of, resulting in this crash:

❯ python pds4_create_xml_index.py /mnt/rms-holdings/pds4-holdings/bundles/uranus_occs_earthbased/uranus_occ_u0_kao_91cm "**/data/rings/*0m.xml" --output-headers-file rings_hdr4.txt --simplify-xpaths --limit-xpaths elements2.txt --generate-label bogus_label_type
XPath headers file generated at rings_hdr4.txt
Traceback (most recent call last):
  File "/seti/all_repos/rms-pds4indextools/pds4indextools/pds4_create_xml_index.py", line 1498, in <module>
    main()
  File "/seti/all_repos/rms-pds4indextools/pds4indextools/pds4_create_xml_index.py", line 1376, in main
    filename = str(Path(index_file).stem)
                   ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/pathlib.py", line 1162, in __init__
    super().__init__(*args)
  File "/usr/lib/python3.12/pathlib.py", line 373, in __init__
    raise TypeError(
TypeError: argument should be a str or an os.PathLike object where __fspath__ returns a str, not 'NoneType'