question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

files.makedirs has no apparent effect

See original GitHub issue

bad:

    files.download(src=...     dest=dl)
    files.makedirs(local, exist_ok=True)  # this has no effect
    server.shell([
        f"aunpack --extract-to={local} {dl}",
    ])

--> Starting operation: Files/Download (src=https://github.com/kovidgoyal/kitty/releases/download/v0.24.4/kitty-0.24.4-x86_64.txz, dest=/tmp/kitty-0.24.4-x86_64.txz)
    [slash] No changes

--> Starting operation: Server/Shell (['aunpack --extract-to=/home/drewp/.local/kitty /tmp/kitty-0.24.4-x86_64.txz'])
    [slash] tar: /home/drewp/.local/kitty: Cannot open: No such file or directory
    [slash] tar: Error is not recoverable: exiting now
    [slash] aunpack: xz ... | tar ...: non-zero return-code
    [slash] Error

good:

    files.download(src=...     dest=dl)
    files.makedirs(local, exist_ok=True)
    server.shell([
        f"mkdir -p {local}",  # this workaround fixed it
        f"aunpack --extract-to={local} {dl}",
    ])

--> Starting operation: Files/Download (src=https://github.com/kovidgoyal/kitty/releases/download/v0.24.4/kitty-0.24.4-x86_64.txz, dest=/tmp/kitty-0.24.4-x86_64.txz)
    [slash] No changes

--> Starting operation: Server/Shell (['mkdir -p /home/drewp/.local/kitty', 'aunpack --extract-to=/home/drewp/.local/kitty /tmp/kitty-0.24.4-x86_64.txz'])
    [slash] Success

–> Support information:

If you are having issues with pyinfra or wish to make feature requests, please
check out the GitHub issues at https://github.com/Fizzadar/pyinfra/issues .
When adding an issue, be sure to include the following:

System: Linux
  Platform: Linux-5.13.0-30-generic-x86_64-with-glibc2.34
  Release: 5.13.0-30-generic
  Machine: x86_64
pyinfra: v1.7
Executable: env/bin/pyinfra
Python: 3.9.9 (CPython, GCC 10.3.0)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
drewpcommented, Mar 17, 2022

Whoa, I never knew __all__ was only to control import *!

Your fix sgtm.

0reactions
Fizzadarcommented, Apr 9, 2022

Whoa, I never knew __all__ was only to control import *!

Me either, only discovered it looking into this!

v2 + 1.7.1 include the fix as above.

Read more comments on GitHub >

github_iconTop Results From Across the Web

os.makedirs wrongly catches extension-less files for directory ...
There is a file: readme and it has no extension. It gets caught in the os.makedirs(directory) claiming that the file exists.
Read more >
Issue 5220: os.makedirs' mode argument has bad default value
My misunderstanding stemmed from recently coming across two widely-used packages which both pass mode=0750 to os.makedirs. I have no idea ...
Read more >
os.makedirs() / os.mkdir() on Windows. No error, but ... - Reddit
Finally, I fixed it by replacing the relative path with the absolute path of the parent directory that I would like to execute...
Read more >
Python | os.makedirs() method - GeeksforGeeks
os.makedirs() method in Python is used to create a directory recursively. ... path: A path-like object representing a file system path.
Read more >
Why you should be using pathlib - Trey Hunner
I hope that this article will inspire you to use Python's pathlib module pretty much anytime you need to work with files in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found