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

Line number of error is incorrect #1256

Closed
dariober opened this issue Nov 11, 2021 · 3 comments
Closed

Line number of error is incorrect #1256

dariober opened this issue Nov 11, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@dariober
Copy link
Contributor

Snakemake version: 6.10.0 installed via bioconda/mamba

Describe the bug

When a snakefile contains a syntax error or some other bug, snakemake reports the wrong line number of the error. More specifically, it seems to me that:

  • The reported line number is consistently after the actual line number
  • As the Snakefile becomes longer, the difference between reported and actual line number grows
  • Earlier versions do not show this bug (e.g. v5.4.3 works)

This is quite a problem since it makes it difficult to locate bugs!

Minimal example

Here the syntax error is on line 9:

rule all:
    input:
        'done.txt',
        
rule trim_transcripts:
    output:
        done.txt,
    run:
        if 1 = 2:  # Syntax error: It should be 1 == 2
            print('foo')

Snakemake 6.10.0 reports the error on line 18:

snakemake -j 1 -n -s Snakefile2
SyntaxError in line 18 of /export/III-data/wcmp_bioinformatics/db291g/git_repos/wcip/20211109_kasia_asaj_snp/Snakefile2:
invalid syntax (Snakefile2, line 18)

Snakemake 5.4.3 is correct:

/export/projects/III-data/wcmp_bioinformatics/db291g/miniconda3/envs/20190312_andy_alba3_motifs/bin/snakemake -j 1 -n -s Snakefile2
SyntaxError in line 9 of /export/III-data/wcmp_bioinformatics/db291g/git_repos/wcip/20211109_kasia_asaj_snp/Snakefile2:
invalid syntax
@Linkrw12
Copy link

This also exists in Snakemake 6.12.1

@dariober
Copy link
Contributor Author

I think it's been fixed in v6.12.3 (thanks!) - please correct me if I'm wrong...

kelly-sovacool added a commit to SchlossLab/mikropml-snakemake-workflow that referenced this issue Jan 5, 2023
@yardimcilab
Copy link

This error persists in version 8.0.1.

@dariober dariober reopened this Jan 5, 2024
dariober added a commit to dariober/snakemake that referenced this issue Jan 5, 2024
The test Snakefile has a syntax error on line 9. Some versions of
Snakemake, including 8.0.1, incorrectly report the error on line 20
johanneskoester pushed a commit that referenced this issue Jan 8, 2024
### Description

Add test for issues #1256 and #2574.

The test Snakefile has a syntax error on line 9. Some versions of
Snakemake, including 8.0.1, incorrectly report the error on line 20. I'm
only submitting the test case, not the fix.

### QC

* [x] The PR contains a test case for the changes or the changes are
already covered by an existing test case.
* [x] 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).
johanneskoester added a commit that referenced this issue Jan 8, 2024
### Description

fix: #2583, #1256 and #2574

### QC
maybe #2583

* [ ] 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).

---------

Co-authored-by: Johannes Köster <johannes.koester@tu-dortmund.de>
@dariober dariober closed this as completed Jan 9, 2024
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

No branches or pull requests

2 participants