New submission from Weinan Li: set root_dir do not work
output: ===================================================== Python 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:25:23) [MSC v.1600 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. >>> import shutil >>> shutil.make_archive("tmp.tar.gz", "gztar", "c:/xjtu", "c:/tmp") 'C:\\Python34\\tmp.tar.gz.tar.gz' ===================================================== source code of make_archive() ===================================================== 756 save_cwd = os.getcwd() 757 if root_dir is not None: 758 if logger is not None: 759 logger.debug("changing into '%s'", root_dir) 760 base_name = os.path.abspath(base_name) 761 if not dry_run: 762 os.chdir(root_dir) ... ... 782 try: 783 filename = func(base_name, base_dir, **kwargs) 784 finally: ===================================================== base_name is set before chdir, so the archive always be created in cwd, whether set root_dir or not. so, line 760 should be move below line 762 ---------- components: Library (Lib) messages: 223568 nosy: DemoHT priority: normal severity: normal status: open title: shutil.make_archive() root_dir do not work type: behavior versions: Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22021> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com