Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"download-recipes" fails with "FileNotFoundError" #6

Open
larsks opened this issue May 20, 2023 · 0 comments · May be fixed by #7
Open

"download-recipes" fails with "FileNotFoundError" #6

larsks opened this issue May 20, 2023 · 0 comments · May be fixed by #7

Comments

@larsks
Copy link

larsks commented May 20, 2023

When trying to use the download-recipes command:

paprika-recipes download-recipes ./recipes

It failed after successfully downloading 46 recipes with:

Downloading Recipes ╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━   2% 0:02:13
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /home/lars/tmp/python/.venv/lib64/python3.11/site-packages/paprika_recipes/cmdline.py:42 in main │
│                                                                                                  │
│   39 │   console = Console()                                                                     │
│   40 │                                                                                           │
│   41 │   try:                                                                                    │
│ ❱ 42 │   │   commands[args.command](config, args).handle()                                       │
│   43 │   except PaprikaError as e:                                                               │
│   44 │   │   console.print(f"[red]{e}[/red]")                                                    │
│   45 │   except PaprikaUserError as e:                                                           │
│                                                                                                  │
│ /home/lars/tmp/python/.venv/lib64/python3.11/site-packages/paprika_recipes/commands/download_rec │
│ ipes.py:28 in handle                                                                             │
│                                                                                                  │
│   25 │   │   for recipe in track(                                                                │
│   26 │   │   │   remote, total=remote.count(), description="Downloading Recipes"                 │
│   27 │   │   ):                                                                                  │
│ ❱ 28 │   │   │   with open(                                                                      │
│   29 │   │   │   │   self.options.export_path / Path(f"{recipe.name}.paprikarecipe.yaml"),       │
│   30 │   │   │   │   "w",                                                                        │
│   31 │   │   │   ) as outf:                                                                      │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
FileNotFoundError: [Errno 2] No such file or directory: 'recipes/Lemon-Garlic Shrimp/Chicken &
Vegetables.paprikarecipe.yaml'

And that's because the recipe title contains a / character. The code should escape / characters.

larsks added a commit to larsks/paprika-recipes that referenced this issue May 20, 2023
Replace "/" in recipe names with "%2F". Without this change a recipe whose
name contains "/" cannot be saved to the filesystem.

Closes coddingtonbear#6
@larsks larsks linked a pull request May 20, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant