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

Editing 'notebooks' with relative paths in Snakefile causes TypeError #1253

Open
bhjolly opened this issue Nov 10, 2021 · 0 comments
Open

Editing 'notebooks' with relative paths in Snakefile causes TypeError #1253

bhjolly opened this issue Nov 10, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@bhjolly
Copy link
Contributor

bhjolly commented Nov 10, 2021

Snakemake version
6.10.0
mamba create -n snakemake -c conda-forge bioconda::snakemake=6.10

Describe the bug
When using --edit-notebook with a Snakefile with a relative notebook path, a TypeError is raised when Snakemake tries to turn that into an absolute path. It looks like the 'basedir' variable type has changed but snakemake/notebook.py was not updated to reflect this.

Logs

Traceback (most recent call last):
  File "/Users/benjolly/miniconda3/envs/snakemake/lib/python3.9/site-packages/snakemake/executors/__init__.py", line 593, in _callback
    raise ex
  File "/Users/benjolly/miniconda3/envs/snakemake/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/Users/benjolly/miniconda3/envs/snakemake/lib/python3.9/site-packages/snakemake/executors/__init__.py", line 579, in cached_or_run
    run_func(*args)
  File "/Users/benjolly/miniconda3/envs/snakemake/lib/python3.9/site-packages/snakemake/executors/__init__.py", line 2461, in run_wrapper
    raise ex
  File "/Users/benjolly/miniconda3/envs/snakemake/lib/python3.9/site-packages/snakemake/executors/__init__.py", line 2418, in run_wrapper
    run(
  File "/Users/benjolly/Documents/arsa-beech/arsa-beech-analysis/workflow/Snakefile", line 253, in __rule_seed_corr
  File "/Users/benjolly/miniconda3/envs/snakemake/lib/python3.9/site-packages/snakemake/notebook.py", line 233, in notebook
    local_path = os.path.join(basedir, path)
  File "/Users/benjolly/miniconda3/envs/snakemake/lib/python3.9/posixpath.py", line 76, in join
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not LocalSourceFile

Minimal example

rule all:
    input:
        "../results/graph.eps"
rule graph:
    output:
        "../results/graph.eps"
    notebook:
        "./notebooks/test.py.ipynb"

then
snakemake --cores 1 --edit-notebook ../results/graph.eps
(obviously need a working Jupyter environment as well)

Additional context

@bhjolly bhjolly added the bug Something isn't working label Nov 10, 2021
johanneskoester added a commit that referenced this issue Nov 23, 2021
* fix bug introduced by LocalSourceFile paths

* Use get_path_or_uri from SourceFile.

Co-authored-by: Johannes Köster <johannes.koester@tu-dortmund.de>
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

1 participant