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

Can you help me to understand the output of snakefmt when it returns an error? #115

Closed
SilasK opened this issue Jul 23, 2021 · 4 comments
Closed

Comments

@SilasK
Copy link

SilasK commented Jul 23, 2021

I got erros like this one:

snakefmt.exceptions.InvalidPython: Got error:

Cannot parse: 2:0:         else:

while formatting code with black.

I don't know to which else statement the error relates.

@SilasK
Copy link
Author

SilasK commented Jul 23, 2021

By the way is there something wrong with having if, else statements around rules. The code works.

@bricoletc
Copy link
Collaborator

Could you paste a minimum reproducible example, or your Snakefile?

@SilasK
Copy link
Author

SilasK commented Jul 31, 2021

here my example, I know it's not minimum

wget https://raw.githubusercontent.com/metagenome-atlas/atlas/1e01601f514ae41c85e08d1d1b2895c24b407180/atlas/rules/assemble.smk

snakefmt assemble.smk

I found the error in my file.
The error was related due to a nested snakemake rule definition around line 243.

Probably double-nested rule definitions are not recommended.

@siebrenf
Copy link

siebrenf commented Dec 6, 2021

Found it too, the error occurs with an elif or else statement after a rule inside the if:

if True:

    rule break_snakefmt_044:
        shell: ""

else:
    pass

Error:

snakefmt.exceptions.InvalidPython: Got error:
'''
Cannot parse: 1:0: else:
'''
while formatting code with black.

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

No branches or pull requests

3 participants