DeprecationWarning from tomli when loading metadata
jaraco opened this issue · 4 comments
jaraco commented
.tox/python/lib/python3.10/site-packages/pep517/build.py:35: in load_system
pyproject_data = toml_load(f)
.tox/python/lib/python3.10/site-packages/tomli/_parser.py:71: in load
warnings.warn(
E DeprecationWarning: Text file object support is deprecated in favor of binary file objects. Use `open("foo.toml", "rb")` to open the file in binary mode.
Triggered thus:
~ $ pip-run pep517 -- -We -c 'import pep517.meta; pep517.meta.load("/Users/jaraco/p/pypa/pep517")'
Collecting pep517
Using cached pep517-0.11.0-py2.py3-none-any.whl (19 kB)
Collecting tomli
Using cached tomli-1.2.1-py3-none-any.whl (11 kB)
Installing collected packages: tomli, pep517
Successfully installed pep517-0.11.0 tomli-1.2.1
Traceback (most recent call last):
File "/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-k4b9iyx6/tomli/_parser.py", line 69, in load
s = s_bytes.decode()
AttributeError: 'str' object has no attribute 'decode'. Did you mean: 'encode'?
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-k4b9iyx6/pep517/meta.py", line 69, in load
system = compat_system(root)
File "/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-k4b9iyx6/pep517/build.py", line 47, in compat_system
system = load_system(source_dir)
File "/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-k4b9iyx6/pep517/build.py", line 35, in load_system
pyproject_data = toml_load(f)
File "/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-k4b9iyx6/tomli/_parser.py", line 71, in load
warnings.warn(
DeprecationWarning: Text file object support is deprecated in favor of binary file objects. Use `open("foo.toml", "rb")` to open the file in binary mode.
I observed that the error did not occur if the current working directory is the pep517 repo, suggesting the issue might not exist on main.
jaraco commented
Indeed, it looks like this was fixed in #122. Maybe cut a release and save people the trouble?
~ $ pip-run -q git+https://github.com/pypa/pep517 -- -We -c 'import pep517.meta; pep517.meta.load("/Users/jaraco/p/pypa/pep517")'
<no output>
jaraco commented
Oh look. I have access to cut releases. In that case, I'll do it.
takluyver commented
Thanks for taking care of it!