Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import Fails on Python 3.7.0 #19

Open
curtis-lamp opened this issue Feb 20, 2022 · 0 comments
Open

Import Fails on Python 3.7.0 #19

curtis-lamp opened this issue Feb 20, 2022 · 0 comments

Comments

@curtis-lamp
Copy link

In 3.7.0 the _ignore_error function doesn't exist in pathlib, so aiopath fails to import.

Adding a try/except block around this import that on except executes the following from cpython would solve this issue.

_WINERROR_NOT_READY = 21  # drive exists but is not accessible
_WINERROR_INVALID_NAME = 123  # fix for bpo-35306
_WINERROR_CANT_RESOLVE_FILENAME = 1921  # broken symlink pointing to itself

_IGNORED_ERRNOS = (ENOENT, ENOTDIR, EBADF, ELOOP)

_IGNORED_WINERRORS = (
    _WINERROR_NOT_READY,
    _WINERROR_INVALID_NAME,
    _WINERROR_CANT_RESOLVE_FILENAME)

def _ignore_error(exception):
    return (getattr(exception, 'errno', None) in _IGNORED_ERRNOS or
            getattr(exception, 'winerror', None) in _IGNORED_WINERRORS)

This would have to be in a 0.5.13 release to support older pythons. I'll happily submit a PR for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant