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

AttributeError: 'Path' object has no attribute 'walk' #794

Closed
2 tasks done
Goldziher opened this issue Sep 27, 2024 · 4 comments · Fixed by #800
Closed
2 tasks done

AttributeError: 'Path' object has no attribute 'walk' #794

Goldziher opened this issue Sep 27, 2024 · 4 comments · Fixed by #800
Labels
documentation Requires additions or changes to the documentation

Comments

@Goldziher
Copy link

Things to check first

  • I have searched the existing issues and didn't find my bug already reported there

  • I have checked that my bug is still present in the latest release

AnyIO version

4.6.0

Python version

3.11

What happened?

Anyio.Path implements the walk method which is available in pathlib.Parth from python 3.12 onwards. For lower versions of python, this causes anyio.Path.walk to through an attribute error.

I expected anyio to implement an alternative using os.walk on lower python versions, or at least to through an informative error instructing the user.

How can we reproduce the bug?

Try using anyio.Path.walk in a lower Python version.

@Goldziher Goldziher added the bug Something isn't working label Sep 27, 2024
@agronholm
Copy link
Owner

IIRC, implementing Path.walk() was not trivial, and I was pressed for time as there were other urgent updates to be done. But if you'd like to take a stab at this, I'm willing to review a PR. But by no means is this a bug.

@smurfix
Copy link
Collaborator

smurfix commented Sep 27, 2024

Path.walkdoesn't exist in Python <3.12 (and throws an AttributeError when you try to use it), so why would I expect a different behavior from anyio.Path.walk?

@agronholm
Copy link
Owner

I suppose because there are other methods that I did implement for all Python versions where their stdlib counterparts required a specific minimum Python version. I can't remember off hand which methods those were though.

@Goldziher
Copy link
Author

Goldziher commented Sep 27, 2024

IIRC, implementing Path.walk() was not trivial, and I was pressed for time as there were other urgent updates to be done. But if you'd like to take a stab at this, I'm willing to review a PR. But by no means is this a bug.

Well, its a question of documentation in this case. I can submit a PR.

BUT - arguing with me whether this is a bug or not, will not in any way help your users, who will eventually find this issue and either traceback to this issue or have to debug it like I have done to find it.

@agronholm agronholm added documentation Requires additions or changes to the documentation and removed bug Something isn't working labels Sep 27, 2024
agronholm added a commit that referenced this issue Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Requires additions or changes to the documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants