showyourwork / showyourwork

A workflow for reproducible and open scientific articles

Home Page:https://show-your.work

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`AttributeError` when running `showyourwork clean --deep`

wtbarnes opened this issue · comments

When doing a "deep clean" of the environment, with showyourwork clean --deep, I get the following exception,

Building DAG of jobs...
Traceback (most recent call last):
  File "/Users/wtbarnes/mambaforge/bin/showyourwork", line 8, in <module>
    sys.exit(entry_point())
  File "/Users/wtbarnes/mambaforge/lib/python3.9/site-packages/showyourwork/cli/__init__.py", line 59, in entry_point
    main()
  File "/Users/wtbarnes/mambaforge/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/wtbarnes/mambaforge/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/wtbarnes/mambaforge/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/wtbarnes/mambaforge/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/wtbarnes/mambaforge/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/wtbarnes/mambaforge/lib/python3.9/site-packages/showyourwork/cli/main.py", line 300, in clean
    commands.clean(
  File "/Users/wtbarnes/mambaforge/lib/python3.9/site-packages/showyourwork/cli/commands/clean.py", line 42, in clean
    if paths.user().home_temp.exists():
AttributeError: 'user' object has no attribute 'home_temp'

As far as I can tell, there is no home_temp attribute exposed on paths.user():

# Temporary paths
self.temp = self.repo / ".showyourwork"
self.temp.mkdir(exist_ok=True)
self.snakemake = self.repo / ".snakemake"
self.cache = self.temp / "cache"
self.cache.mkdir(exist_ok=True)
self.preprocess = self.temp / "preprocess"
self.preprocess.mkdir(exist_ok=True)
self.compile = self.temp / "compile"
self.compile.mkdir(exist_ok=True)
self.logs = self.temp / "logs"
self.logs.mkdir(exist_ok=True)
self.zenodo = self.temp / "zenodo"
self.zenodo.mkdir(exist_ok=True)
self.zenodo_ids = self.zenodo / "ids"
self.zenodo_ids.mkdir(exist_ok=True)
self.sandbox = self.temp / "sandbox"
self.sandbox.mkdir(exist_ok=True)
self.sandbox_ids = self.sandbox / "ids"
self.sandbox_ids.mkdir(exist_ok=True)
self.overleaf = self.temp / "overleaf"
self.overleaf.mkdir(exist_ok=True)
self.flags = self.temp / "flags"
self.flags.mkdir(exist_ok=True)
. Is this meant to be just temp?

Thanks for the report! It looks like temp is cleaned up above, so I expect this should just be removed. Would you be willing to open a PR?

Sure! Is this just a matter of removing the last conditional inside of the if deep conditional?

Great! Yeah - that seems like it should do the trick. Thanks!