Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

@staticmethod
    def _switch_path(path):
        from contextlib import suppress
        import zipfile
        from pathlib import Path
        with suppress(Exception):
            return zipfile.Path(path)
        return Path(path)

Oh, I did not know about zipfile.Path!

I do not think this is a correct solution. It does not work with general 
loaders. I think that it would be more correct to override some methods in 
zipimport.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37162>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to