Skip to content

RuntimeError in filepattern.infer_pattern with non-alphanumeric characters in file names #102

@hamshkhawar

Description

@hamshkhawar

When calling filepattern.infer_pattern on a folder with files that contain non-alphanumeric characters, the function raises a RuntimeError:

RuntimeError                              Traceback (most recent call last)
Cell In[6], line 6
      3 path = "/Users/hamdah.abbasi/Downloads/out/ome"
      5 imagepaths = [f for f in Path(path).iterdir()]
----> 6 pattern = fp.infer_pattern(path)
      8 print(pattern)
      9 # fp = filepattern.FilePattern(
     10 #             path=path,
     11 #             pattern=filepattern.infer_pattern(
   (...)     14 #         )
     15 # base_output = fp.output_name()

File ~/Documents/medical_imaging/Repos/featureforge_cellpainting/.venv/lib/python3.12/site-packages/filepattern/functions.py:59, in infer_pattern(path, files, variables, block_size)
     56     raise ValueError("Pass in only a path or list of files, not both.")
     58 if files == []:
---> 59     return backend.FilePattern.inferPattern(str(path), str(variables), str(block_size))
     60 else:
     61     return backend.FilePattern.inferPattern(files, variables)

RuntimeError: Non-numeric, non-alphabetic characters found that do not match

Week1_22141.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions