Title: Bug report: shutil.make_archive() makes empty archive file even when root_dir does not exists · Issue #99203 · python/cpython · GitHub
Open Graph Title: Bug report: shutil.make_archive() makes empty archive file even when root_dir does not exists · Issue #99203 · python/cpython
X Title: Bug report: shutil.make_archive() makes empty archive file even when root_dir does not exists · Issue #99203 · python/cpython
Description: Bug report In python 3.10+, shutil.make_archive() makes empty archive file and does not raise any error even when root_dir does not exists. In python -3.9, FileNotFoundError is raised with message [Errno 2] No such file or directory: ‘xx...
Open Graph Description: Bug report In python 3.10+, shutil.make_archive() makes empty archive file and does not raise any error even when root_dir does not exists. In python -3.9, FileNotFoundError is raised with message ...
X Description: Bug report In python 3.10+, shutil.make_archive() makes empty archive file and does not raise any error even when root_dir does not exists. In python -3.9, FileNotFoundError is raised with message ...
Opengraph URL: https://github.com/python/cpython/issues/99203
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Bug report: shutil.make_archive() makes empty archive file even when root_dir does not exists","articleBody":"# Bug report\r\n\r\nIn python 3.10+, shutil.make_archive() makes empty archive file and does not raise any error even when root_dir does not exists.\r\nIn python -3.9, FileNotFoundError is raised with message `[Errno 2] No such file or directory: ‘xxxxxxx’`.\r\n\r\n```\r\nimport shutil\r\n\r\nshutil.make_archive(base_name='aaa_archive', root_dir=\"not_existing_dir\", format=\"zip\")\r\n# This will raise FileNotFoundError in python ~3.9, where it doesn’t in 3.10~\r\n```\r\n\r\nI though making empty archive file is unnatural, so fixing it maybe good for backward compatibility.\r\n\r\nI think this problem is caused in this line, where `os.chdir(root_dir)` is not called anymore.\r\nIn the previous code, `os.chdir(root_dir)` will raise FileNotFoundError when root_dir does not exists.\r\nhttps://github.com/python/cpython/pull/93160/files#diff-db8ac59326160713929e0e1973aef54f0280fe9f154ef24d14244909a0e0689bL1084 \r\n\r\nI thought checking the existence of root_dir and raise FileNotFoundError when root_dir is not found, might be a good implementation to fix this problem.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-99802\n* gh-107998\n* gh-107999\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/mski-iksm","@type":"Person","name":"mski-iksm"},"datePublished":"2022-11-07T15:07:32.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/99203/cpython/issues/99203"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f7fabf2f-3525-b480-2b92-ddb4f001e8b1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C9A4:B6892:CF41B:10FC96:6969C77C |
| html-safe-nonce | 6f0aa68d7fe2e178ebe3f12e3157706668de2f659c1766cf5ab0020cbd16b491 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOUE0OkI2ODkyOkNGNDFCOjEwRkM5Njo2OTY5Qzc3QyIsInZpc2l0b3JfaWQiOiI3NjY2NDQ3Mzk0NTUwNjk1ODA0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 87a602d6130a911ebab1b0e4cd48eeb63d8ad6a3986b74ffe23e3c9755745fe1 |
| hovercard-subject-tag | issue:1438519740 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/99203/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cd68b3bf1df9b328b23d0e76dd25ea40032f63ead0546bbdbe81e816878c7864/python/cpython/issues/99203 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cd68b3bf1df9b328b23d0e76dd25ea40032f63ead0546bbdbe81e816878c7864/python/cpython/issues/99203 |
| og:image:alt | Bug report In python 3.10+, shutil.make_archive() makes empty archive file and does not raise any error even when root_dir does not exists. In python -3.9, FileNotFoundError is raised with message ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mski-iksm |
| hostname | github.com |
| expected-hostname | github.com |
| None | acedec8b5f975d9e3d494ddd8f949b0b8a0de59d393901e26f73df9dcba80056 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 83c08c21cdda978090dc44364b71aa5bc6dcea79 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width