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

f-strings no longer accepted in shell commands #2586

Closed
tsnorri opened this issue Jan 5, 2024 · 1 comment · Fixed by #2588
Closed

f-strings no longer accepted in shell commands #2586

tsnorri opened this issue Jan 5, 2024 · 1 comment · Fixed by #2588
Labels
bug Something isn't working

Comments

@tsnorri
Copy link

tsnorri commented Jan 5, 2024

Snakemake version
8.0.1, also tested the main branch. Snakemake 7.32.4 does not have the bug.

Describe the bug
Passing an f-string to the shell command results in an error message similar to the following one:

SyntaxError in file /Users/tsnorri/snakemake-bug-test/Snakefile, line 7:
unterminated f-string literal (detected at line 7) (Snakefile, line 7)

Minimal example

rule all:
	shell:	f"echo 'test'"

Snakemake 8.0.1 accepts the input if the f-string is changed to a plain one.

Additional context
The second example on the page Snakefiles and Rules in Snakemake’s documentation demonstrates the use of an f-string with the shell command.

@tsnorri tsnorri added the bug Something isn't working label Jan 5, 2024
@Hocnonsense
Copy link
Contributor

yes,it's indeed a bug. For a quick fix, you may change the single quote " to the longer one """

johanneskoester pushed a commit that referenced this issue Jan 8, 2024
### Description

fix #2586 for some cases do not considered in #2485

### QC
<!-- Make sure that you can tick the boxes below. -->

* [x] The PR contains a test case for the changes or the changes are
already covered by an existing test case.
* [ ] The documentation (`docs/`) is updated to reflect the changes or
this is not necessary (e.g. if the change does neither modify the
language nor the behavior or functionalities of Snakemake).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants