Message216672
>>> from shutil import make_archive; make_archive("a", "tar")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.4/shutil.py", line 783, in make_archive
filename = func(base_name, base_dir, **kwargs)
File "/usr/lib/python3.4/shutil.py", line 605, in _make_tarball
os.makedirs(archive_dir)
File "/usr/lib/python3.4/os.py", line 244, in makedirs
mkdir(name, mode)
FileNotFoundError: [Errno 2] No such file or directory: ''
Looking at the code, it calls os.path.dirname("a.tar") -> "", which would be the cause of this bug.
The workaround for me was adding an explicit make_archive(root_dir=".") parameter.
I was also surprised to see the code calling os.makedirs(archive_dir). Usually if you try to make a file in a non-existent directory, it fails, rather than automatically creating the directory for you. But maybe that’s just a general spirit of the “shutil” module that I didn’t pick up on. |
|
Date |
User |
Action |
Args |
2014-04-17 08:09:59 | martin.panter | set | recipients:
+ martin.panter |
2014-04-17 08:09:59 | martin.panter | set | messageid: <1397722199.92.0.999945404475.issue21280@psf.upfronthosting.co.za> |
2014-04-17 08:09:59 | martin.panter | link | issue21280 messages |
2014-04-17 08:09:59 | martin.panter | create | |
|