SyntaxError: f-string expression part cannot include a backslash #1057

Closed
opened 2025-04-06 21:43:03 +00:00 by bb Β· 6 comments
Contributor

What I'm trying to do and why

Getting it to run at all πŸ™„

Steps to reproduce

root@foo ~ # pipx list
venvs are in /root/.local/pipx/venvs
apps are exposed on your $PATH at /root/.local/bin
   package borgmatic 2.0.0, installed using Python 3.10.12
    - borgmatic
    - generate-borgmatic-config
    - validate-borgmatic-config
root@foo ~ # borgmatic --help
Traceback (most recent call last):
  File "/root/.local/bin/borgmatic", line 5, in <module>
    from borgmatic.commands.borgmatic import main
  File "/root/.local/pipx/venvs/borgmatic/lib/python3.10/site-packages/borgmatic/commands/borgmatic.py", line 13, in <module>
    import borgmatic.actions.borg
  File "/root/.local/pipx/venvs/borgmatic/lib/python3.10/site-packages/borgmatic/actions/borg.py", line 3, in <module>
    import borgmatic.borg.borg
  File "/root/.local/pipx/venvs/borgmatic/lib/python3.10/site-packages/borgmatic/borg/borg.py", line 4, in <module>
    import borgmatic.commands.arguments
  File "/root/.local/pipx/venvs/borgmatic/lib/python3.10/site-packages/borgmatic/commands/arguments.py", line 360
    pattern = re.compile(fr'^--{flag_name.replace("[0]", r"\[\d+\]").replace(".", r"\.")}$')
                                                                                           ^
SyntaxError: f-string expression part cannot include a backslash

Actual behavior

Crashes on borgmatic --help, borgmatic --version... basically anything.

Expected behavior

Never crash πŸ˜ƒ

Other notes / implementation ideas

No response

borgmatic version

2.0.0 (but borgmatic --version fails)

borgmatic installation method

pipx upgrade-all; also tried pipx uninstall and then pipx install

Borg version

borg 1.2.8

Python version

Python 3.10.12

Database version (if applicable)

No response

Operating system and version

Ubuntu 22.04.5 LTS

### What I'm trying to do and why Getting it to run at all πŸ™„ ### Steps to reproduce ``` root@foo ~ # pipx list venvs are in /root/.local/pipx/venvs apps are exposed on your $PATH at /root/.local/bin package borgmatic 2.0.0, installed using Python 3.10.12 - borgmatic - generate-borgmatic-config - validate-borgmatic-config root@foo ~ # borgmatic --help Traceback (most recent call last): File "/root/.local/bin/borgmatic", line 5, in <module> from borgmatic.commands.borgmatic import main File "/root/.local/pipx/venvs/borgmatic/lib/python3.10/site-packages/borgmatic/commands/borgmatic.py", line 13, in <module> import borgmatic.actions.borg File "/root/.local/pipx/venvs/borgmatic/lib/python3.10/site-packages/borgmatic/actions/borg.py", line 3, in <module> import borgmatic.borg.borg File "/root/.local/pipx/venvs/borgmatic/lib/python3.10/site-packages/borgmatic/borg/borg.py", line 4, in <module> import borgmatic.commands.arguments File "/root/.local/pipx/venvs/borgmatic/lib/python3.10/site-packages/borgmatic/commands/arguments.py", line 360 pattern = re.compile(fr'^--{flag_name.replace("[0]", r"\[\d+\]").replace(".", r"\.")}$') ^ SyntaxError: f-string expression part cannot include a backslash ``` ### Actual behavior Crashes on `borgmatic --help`, `borgmatic --version`... basically anything. ### Expected behavior Never crash πŸ˜ƒ ### Other notes / implementation ideas _No response_ ### borgmatic version 2.0.0 (but borgmatic --version fails) ### borgmatic installation method pipx upgrade-all; also tried pipx uninstall and then pipx install ### Borg version borg 1.2.8 ### Python version Python 3.10.12 ### Database version (if applicable) _No response_ ### Operating system and version Ubuntu 22.04.5 LTS
Author
Contributor

As a sidenote, maybe the major version release allows removing the deprecated generate-borgmatic-config and validate-borgmatic-config?

As a sidenote, maybe the major version release allows removing the deprecated `generate-borgmatic-config` and `validate-borgmatic-config`?
Owner

Ah I was looking forward to the first showstopper bug after the 2.0.0 release. You win the award for finding it! πŸ†

This might be a Python version incompatibility thing. I'll look into it.

Ah I was looking forward to the first showstopper bug after the 2.0.0 release. You win the award for finding it! πŸ† This might be a Python version incompatibility thing. I'll look into it.
Owner

As a sidenote, maybe the major version release allows removing the deprecated generate-borgmatic-config and validate-borgmatic-config?

Oh there's tons of deprecated stuff that could be removed. I chose not to do it for this release, but watch out for the next one!

> As a sidenote, maybe the major version release allows removing the deprecated generate-borgmatic-config and validate-borgmatic-config? Oh there's tons of deprecated stuff that could be removed. I chose not to do it for this release, but watch out for the next one!
Owner
  • Python 3.13: βœ… works
  • Python 3.12: βœ… works
  • Python 3.11: ❌ broken
  • Python 3.10: ❌ broken
  • Python 3.9: ❌ broken
* Python 3.13: βœ… works * Python 3.12: βœ… works * Python 3.11: ❌ broken * Python 3.10: ❌ broken * Python 3.9: ❌ broken
Owner

Fixed in main and released in borgmatic 2.0.1! Thanks for filing this one!

Fixed in main and released in borgmatic 2.0.1! Thanks for filing this one!
Author
Contributor

I can confirm: works great now. And once again big props for the super quick response time!

I can confirm: works great now. And once again big props for the super quick response time!
Sign in to join this conversation.
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
borgmatic-collective/borgmatic#1057
No description provided.