New submission from Martin Panter:
>>> 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.
----------
components: Library (Lib)
messages: 216672
nosy: vadmium
priority: normal
severity: normal
status: open
title: shutil.make_archive() with default "root_dir" parameter raises
FileNotFoundError: [Errno 2] No such file or directory: ''
versions: Python 2.7, Python 3.4
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue21280>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com