glevyhas/pix-plot

Metadata tag filter filename too long errors

Opened this issue · 0 comments

This is an odd one I ran into. I'm using hashtags for the category filters and ran into an issue with too long hashtags. PixPlot seems to be creating a json file for every tag that contains a list of related images. Using the tag itself for the filename seems to create some problems. A first look, I thought I could just hash the tag at the linked line or something similar to control the length, but I realized that the filter would not be able to find the file. The filter uses the tag that is selected to create the filename that it opens. I could change the tag to a hash in both places (i.e., the filter.json file and the filename), but of course then the front end would display a hash instead of the tag. Around we go.

One "easy" solution would be to modify the filter.json so that it contains a list of tags plus reference filenames. That way the frontend could display the tag, but, upon selection, it would open an associated filename. Then the filename could be controlled and standardized. I put "easy" in quotes because my frontend/javascript skills are not good enough to read in the modified json file correctly.

Here is an example of one of the errors I have seen.

Traceback (most recent call last):
File "/usr/src/app/pixplot/pixplot.py", line 1334, in <module>
    parse()\n  File "/usr/src/app/pixplot/pixplot.py", line 1331, in parse
    process_images(**config)\n  File "/usr/src/app/pixplot/pixplot.py", line 147, in process_images
    kwargs[\'image_paths\'], kwargs[\'metadata\'] = filter_images(**kwargs)
  File "/usr/src/app/pixplot/pixplot.py", line 248, in filter_images
    write_metadata(**kwargs)\n  File "/usr/src/app/pixplot/pixplot.py", line 356, in write_metadata
    write_json(os.path.join(out_dir, \'options\', i + \'.json\'), d[i], **kwargs)
  File "/usr/src/app/pixplot/pixplot.py", line 1147, in write_json
    with open(path, \'w\') as out:\nOSError: [Errno 36] File name too long: \'/usr/src/app/data/plots/2022-04-10-215744-Query-fd6da2de0e98a7319d21ba3f1a7a110e/data/metadata/options/:black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart::black_heart:.json

Obviously that's a pretty crap tag, but I didn't make it. Or choose the dataset. 😆