[issue43219] shutil.copy raises IsADirectoryError when the directory does not actually exist
Jeremy Pinto added the comment: In fact, the issue seems to be coming from open() itself when opening a non-existent directory in write mode: [nav] In [1]: import os ...: nonexixstent_dir = 'not_a_dir/' ...: assert not os.path.exists(nonexixstent_dir) ...: with open(nonexixstent_dir, 'wb') as fdst: ...: pass --- IsADirectoryError Traceback (most recent call last) in 2 dir_path = 'not_a_dir/' 3 assert not os.path.exists(nonexixstent_dir) > 4 with open(nonexixstent_dir, 'wb') as fdst: 5 pass IsADirectoryError: [Errno 21] Is a directory: 'not_a_dir/' -- ___ Python tracker <https://bugs.python.org/issue43219> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43219] shutil.copy raises IsADirectoryError when the directory does not actually exist
New submission from Jeremy Pinto : Issue: If you try to copy a file to a directory that doesn't exist using shutil.copy, a IsADirectory error is raised saying the directory exists. This issue is actually caused when `open(not_a_dir, 'wb') is called on a non-existing dir. Expected behaviour: Should instead raise NotADirectoryError - Steps to reproduce: [nav] In [1]: import os ...: from pathlib import Path ...: from shutil import copy ...: ...: tmp_file = '/tmp/some_file.txt' ...: Path(tmp_file).touch() ...: nonexistent_dir = 'not_a_dir/' ...: assert not os.path.exists(nonexistent_dir) ...: copy(tmp_file, nonexistent_dir) --- IsADirectoryError Traceback (most recent call last) in 7 nonexistent_dir = 'not_a_dir/' 8 assert not os.path.exists(nonexistent_dir) > 9 copy(tmp_file, nonexistent_dir) ~/miniconda3/lib/python3.7/shutil.py in copy(src, dst, follow_symlinks) 243 if os.path.isdir(dst): 244 dst = os.path.join(dst, os.path.basename(src)) --> 245 copyfile(src, dst, follow_symlinks=follow_symlinks) 246 copymode(src, dst, follow_symlinks=follow_symlinks) 247 return dst ~/miniconda3/lib/python3.7/shutil.py in copyfile(src, dst, follow_symlinks) 119 else: 120 with open(src, 'rb') as fsrc: --> 121 with open(dst, 'wb') as fdst: 122 copyfileobj(fsrc, fdst) 123 return dst IsADirectoryError: [Errno 21] Is a directory: 'not_a_dir/' -- messages: 386932 nosy: jerpint priority: normal severity: normal status: open title: shutil.copy raises IsADirectoryError when the directory does not actually exist versions: Python 3.7 ___ Python tracker <https://bugs.python.org/issue43219> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40562] SEO: differentiate between Python 2 and Python 3 docs on Google SERP
Pinto added the comment: Merci Julien j'ai reussi à régler le même problème rencontré sur mon site https://lesmarketing.fr/agence-seo-montpellier/ -- ___ Python tracker <https://bugs.python.org/issue40562> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40562] SEO: differentiate between Python 2 and Python 3 docs on Google SERP
Pinto added the comment: I have the same problem on my site https://lesmarketing.fr I deactivated the breadcrumbs, you have found a solution ? -- nosy: +khaled ___ Python tracker <https://bugs.python.org/issue40562> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36085] Enable better DLL resolution
David Miguel Susano Pinto added the comment: I have just found out that commit 2438cdf0e93 which added the winmode argument and the documentation for it disagree. Documentation states that default is zero while the real default in code is None. I have opened PR 19167 on github to address it -- message_count: 60.0 -> 61.0 nosy: +carandraug nosy_count: 14.0 -> 15.0 pull_requests: +18563 pull_request: https://github.com/python/cpython/pull/19167 ___ Python tracker <https://bugs.python.org/issue36085> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35338] set union/intersection/difference could accept zero arguments
New submission from David Miguel Susano Pinto : set union, intersection, difference methods accept any non-zero number of sets and return a new set instance, like so: >>> a = set([1, 2]) >>> b = set([1, 3]) >>> c = set([3, 5]) >>> set.union(a, b, c) {1, 2, 3, 5} even if it's only one argument: >>> set.union(a) {1, 2} I think it would be nice if zero arguments were not an error: >>> set.union() Traceback (most recent call last): File "", line 1, in TypeError: descriptor 'union' of 'set' object needs an argument This would allow to handle any sequence of sets which otherwise requires this: if len(sequence): return set.union(*sequence) else: return set() -- messages: 330601 nosy: carandraug priority: normal severity: normal status: open title: set union/intersection/difference could accept zero arguments type: enhancement versions: Python 3.7 ___ Python tracker <https://bugs.python.org/issue35338> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com