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

Error with nested else statement, InvalidPython #96

Closed
supermaxiste opened this issue Feb 12, 2021 · 2 comments
Closed

Error with nested else statement, InvalidPython #96

supermaxiste opened this issue Feb 12, 2021 · 2 comments

Comments

@supermaxiste
Copy link

Hi,

I was trying to run a --check on my Snakemake workflow and I got a parsing error related to a nested else statement. This issue might be similar to #91.

For my Snakefile I get the following error:

[ERROR] In file "Snakefile":  'InvalidPython: Got error:
'''
Cannot parse: 1:0: else:
'''
while formatting code with black.'

This parsing error doesn't appear when I comment this else statement in my code:

if len(config) == 0:
	if os.path.isfile("./config.yaml"):
		configfile: "./config.yaml"
	#else:
		#sys.exit(f"Make sure there is a config.yaml file in {os.getcwd()} or specify one with the --configfile commandline parameter.")
bricoletc added a commit that referenced this issue Feb 14, 2021
This had already been logged as an issue via a unit test marked 'xfail';
fix now passes that test.
@bricoletc
Copy link
Collaborator

Thanks @supermaxiste , this was indeed a bug, and I made a fix in branch fix_96. It now parses your Snakefile without error. We'll look to release a new version on PyPI soon, else you could try installing from source from branch fix_96 and let us know if all OK!

@supermaxiste
Copy link
Author

Hi @bricoletc,

just checked the branch and tried a run on my Snakefile, no parsing errors.

Thank you and feel free to close the issue anytime.

bricoletc added a commit that referenced this issue Feb 15, 2021
This had already been logged as an issue via a unit test marked 'xfail';
fix now passes that test.
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

2 participants