galaxyproject / galaxyproject/planemo
workflow_test_init fails with FileNotFoundError when workflow input labels contain forward slashes (/)
- Dominant language
- Python
- Stars
- 110
- Forks
- 102
- Avg merge
- 4d 21h
- Merged PRs (30d)
- 13
Description
# Description
When using Planemo to generate workflow test files (e.g., for GTN tutorials) from an existing workflow invocation, the process crashes if any of the workflow input labels contain a forward slash (/).
Galaxy permits the use of / in the Label field within the workflow editor, and the workflow executes successfully. However, when Planemo attempts to download the datasets, it interprets the / in the label as a subdirectory separator, leading to a FileNotFoundError.
vs
# Steps to Reproduce
Create a Galaxy workflow where an input dataset has a label containing a slash (e.g., Video/Audio File).
Run the workflow to generate a workflow invocation.
Attempt to generate test files using Planemo (e.g., using a public history and invocation ID).
Example Invocation ID: 2a249a9d29a8dbbe
Example History: https://usegalaxy.eu/u/armin.dadras/h/training-automated-speech-recognition
Planemo crashes during the dataset download step.
# Expected Behavior
Planemo should sanitize the input label name (e.g., by replacing / with _ or -) before using it to construct the file path, allowing the dataset to be successfully saved into the test-data directory.
# Actual Behavior / Error Log
Planemo crashes with a FileNotFoundError because it attempts to save the file into a non-existent subdirectory.
```
Traceback:
Python
Traceback (most recent call last):
File "/home/armin/miniconda3/envs/mfa/bin/planemo", line 10, in
sys.exit(planemo())
~~~~~~~^^
# ... [Click internal tracebacks omitted for brevity] ...
File "/home/armin/miniconda3/envs/mfa/lib/python3.13/site-packages/planemo/commands/cmd_workflow_test_init.py", line 45, in cli
job = job_template(workflow_identifier, **kwds)
File "/home/armin/miniconda3/envs/mfa/lib/python3.13/site-packages/planemo/galaxy/workflows.py", line 300, in job_template
return _job_inputs_template_from_invocation(workflow_path, kwds["galaxy_url"], kwds["galaxy_user_key"])
File "/home/armin/miniconda3/envs/mfa/lib/python3.13/site-packages/planemo/galaxy/workflows.py", line 424, in _job_inputs_template_from_invocation
user_gi.datasets.download_dataset(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
input_step["id"], use_default_filename=False, file_path=f"test-data/{input_step['label']}.{ext}"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/home/armin/miniconda3/envs/mfa/lib/python3.13/site-packages/bioblend/galaxy/datasets/__init__.py", line 182, in download_dataset
with open(file_local_path, "wb") as fp:
~~~~^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'test-data/Video/Audio File.mp4'
```
Contributor guide
Assessment
This issue has not been assessed yet.