[BUG] AttributeError: 'WindowsPath' object has no attribute 'read_text'
See original GitHub issuesetuptools version
setuptools==60.7.0
Python version
3.8.10
OS
Windows 10
Additional environment information
No response
Description
There’s regression in compare to previous setuptools==60.6.0 (which works)
E.g. installing latest setuptools and pip and then installing e.g. pathlib
fails with following error: AttributeError: 'WindowsPath' object has no attribute 'read_text'
Expected behavior
it works
How to Reproduce
- install latest pip (22.0.2)
- install latest setuptools (60.7.0)
- install pathlib using pip
Output
python -m pip install -U pip
(cut)
pip install -U setuptools
(cut)
(venv) C:\Temp\setuptools>pip install -U pathlib
Collecting pathlib
Using cached pathlib-1.0.1.tar.gz (49 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [12 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 14, in <module>
File "c:\temp\setuptools\venv\lib\site-packages\setuptools\__init__.py", line 16, in <module>
import setuptools.version
File "c:\temp\setuptools\venv\lib\site-packages\setuptools\version.py", line 1, in <module>
import pkg_resources
File "c:\temp\setuptools\venv\lib\site-packages\pkg_resources\__init__.py", line 74, in <module>
from pkg_resources.extern.jaraco.text import (
File "c:\temp\setuptools\venv\lib\site-packages\pkg_resources\_vendor\jaraco\text\__init__.py", line 227, in <module>
lorem_ipsum: str = files(__name__).joinpath('Lorem ipsum.txt').read_text()
AttributeError: 'WindowsPath' object has no attribute 'read_text'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Python docx AttributeError: 'WindowsPath' object has no ...
When I wrapped the PDF file in FileIO like so FileIO(pdf_path, "rb") the error went away and I was able to process the...
Read more >AttributeError: 'WindowsPath' object has no attribute 'read' · ...
This "AttributeError: 'WindowsPath' object has no attribute 'read'" from #273 ... Update: installed pydub 0.23.1 and keep getting the error:
Read more >python-docx AttributeError: 'WindowsPath' object has no ...
After Debugging I got this Error. It only occurs on line 10. Exception has occurred: AttributeError 'WindowsPath' object has no attribute ...
Read more >I get the error : 'WindowsPath' object has no attribute 'read', ...
I get the error : 'WindowsPath' object has no attribute 'read', any ideas ? ... Learn on the go with our new app....
Read more >attributeerror: module 'posixpath' has no attribute 'splittext'
I'm following lesson 5 in Google Colab, trying to use Path, but I'm getting the following error: AttributeError: 'PosixPath' object has no attribute...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We have the
pathlib
as a dependency, probably fromhexrec
package. Now I can see the most recent version got rid of it: “Removed dependency of legacy pathlib package; using Python’s own module instead.”No, just with pathlib
At the end - we can easily fix to upgrade the
hexrec
package which do not rely on obsoletepathlib
any more.This ticket can be closed if I understand it correctly.
I’m using the built-in pathlib so it is a different issue.