[issue40271] Allow shell like paths in

2020-04-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If add such option to zipfile.is_zipfile(), why not add it to other functions? There are many tens or hundreds of functions and methods in the stdlib which accept a file path. Adding such option to all of them is not practical. And zipfile.is_zipfile() doe

[issue40271] Allow shell like paths in

2020-04-16 Thread Massimo Sala
Massimo Sala added the comment: Gavin, zipfile works on all the operating systems where python runs. Your request is OS dependent... BSD? linux? The tilde isn't into the ZIP file specifications. I have to agree with Serhiy: the correct solution is os.path.expanduser("~/stuff") --

[issue40271] Allow shell like paths in

2020-04-14 Thread Gavin D'souza
Gavin D'souza added the comment: @serhiy.storchaka That makes perfect sense. Could we do something to add a parameter perhaps, to evaluate literal paths to not bread existing code? although this isn't "needed" but it'd be neat to handle this internally -- ___

[issue40271] Allow shell like paths in

2020-04-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: How would you work with a file in the "~" directory? Python is a programming language. It provides you builtin blocks which you can combine to get the desired behavior. If you what "~" at the start of the path be expanded to your home directory, you call o

[issue40271] Allow shell like paths in

2020-04-13 Thread Gavin D'souza
Gavin D'souza added the comment: Thank you @xtreak, I'm aware of "os.path.expanduser" and have used it extensively; I created this issue if we could do something about handling this internally in zipfile too. -- ___ Python tracker

[issue40271] Allow shell like paths in

2020-04-13 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: You can use os.path.expanduser to expand tilde. Other os functions don't do it implicitly. >>> import os >>> os.path.exists("~/stuff") False >>> os.path.exists(os.path.expanduser("~/stuff")) True -- nosy: +xtreak __

[issue40271] Allow shell like paths in

2020-04-13 Thread Gavin D'souza
New submission from Gavin D'souza : Related library: zipfile Since zipfile allows relative dotted paths too, should shell-like paths, specifically with ~ (tilde) be allowed too? This feels like unexpected behaviour and confusing for users as method "is_zipfile" returns False in case path doe