Re: how to fix TypeError: expected string or bytes-like object ?
Hi, On Wed, Oct 05, 2022 at 02:28:56PM +0300, Felix Yan wrote: On 10/5/22 14:02, Bo YU wrote: ``` vimer@dev:~/build/rfs/packages/test_dir$ sudo pip3 install sphinxcontrib-ditaa Collecting sphinxcontrib-ditaa Using cached sphinxcontrib-ditaa-1.0.1.tar.gz (7.5 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error [...] return self._name_from_stem(stem) or super()._normalized_name File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 622, in _normalized_name return Prepared.normalize(self.name) File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 871, in normalize return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_') File "/usr/lib/python3.10/re.py", line 209, in sub return _compile(pattern, flags).sub(repl, string, count) TypeError: expected string or bytes-like object [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. ``` You are right. The traceback is indeed different but more similar to this one, probably: https://github.com/pypa/setuptools/issues/3273 I have tried to make an empty .dist-info dir and got the very similar result to yours. The following command may help to locate the actual offending package: strace -eopenat python -c "from importlib.metadata import entry_points; print(entry_points(group='sphinx.builders'))" Great! It works. I deleted the package that was installed by setup.py with above command hint. Everythng is well now. Many thanks~ -- Regards, -- Bo YU signature.asc Description: PGP signature
Re: Debian Python Team Sprint: December 2-3-4 2022
On 2022-09-12 17 h 08, Louis-Philippe Véronneau wrote: Hello! Our next team sprint will be on December 2-3-4 2022 and will be remote. Please register on this wiki page if you are interested: https://wiki.debian.org/Sprints/2022/PythonTeam There are plenty of items in the 'Agenda' section for people who want to help out but have no idea on what to work on :) Please note you need to register **before October 15th** to get food sponsorship. Cheers, Hello hello, Reminder: the deadline to sign up and get food sponsorship is *October 15th*. That's next week! Cheers, -- ⢀⣴⠾⠻⢶⣦⠀ ⣾⠁⢠⠒⠀⣿⡁ Louis-Philippe Véronneau ⢿⡄⠘⠷⠚⠋ po...@debian.org / veronneau.org ⠈⠳⣄ OpenPGP_0xE1E5457C8BAD4113.asc Description: OpenPGP public key OpenPGP_signature Description: OpenPGP digital signature
Request to join Debian Python Team
Hello, I would like to join the Debian Python Team to help with general Python package maintenance. There is a lot of overlap with what I already work on in the domain-specific Debian Science Team. My Salsa login is kkremitzki. I have read and agree to the Debian Python Team Policy.
Re: how to fix TypeError: expected string or bytes-like object ?
On 10/5/22 14:02, Bo YU wrote: ``` vimer@dev:~/build/rfs/packages/test_dir$ sudo pip3 install sphinxcontrib-ditaa Collecting sphinxcontrib-ditaa Using cached sphinxcontrib-ditaa-1.0.1.tar.gz (7.5 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [30 lines of output] Traceback (most recent call last): File "", line 2, in File "", line 34, in File "/tmp/pip-install-c2wygkxs/sphinxcontrib-ditaa_10e1c64028af47e59b8fc5bf20b6901c/setup.py", line 8, in setup( File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 86, in setup _install_setup_requires(attrs) File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 75, in _install_setup_requires dist = MinimalDistribution(attrs) File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 57, in __init__ super().__init__(filtered) File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 474, in __init__ for ep in metadata.entry_points(group='distutils.setup_keywords'): File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 1009, in entry_points return SelectableGroups.load(eps).select(**params) File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 459, in load ordered = sorted(eps, key=by_group) File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 1006, in eps = itertools.chain.from_iterable( File "/usr/lib/python3.10/importlib/metadata/_itertools.py", line 16, in unique_everseen k = key(element) File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 941, in _normalized_name return self._name_from_stem(stem) or super()._normalized_name File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 622, in _normalized_name return Prepared.normalize(self.name) File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 871, in normalize return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_') File "/usr/lib/python3.10/re.py", line 209, in sub return _compile(pattern, flags).sub(repl, string, count) TypeError: expected string or bytes-like object [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. ``` You are right. The traceback is indeed different but more similar to this one, probably: https://github.com/pypa/setuptools/issues/3273 I have tried to make an empty .dist-info dir and got the very similar result to yours. The following command may help to locate the actual offending package: strace -eopenat python -c "from importlib.metadata import entry_points; print(entry_points(group='sphinx.builders'))" -- Regards, Felix Yan OpenPGP_signature Description: OpenPGP digital signature
Re: how to fix TypeError: expected string or bytes-like object ?
Hi, On Wed, Oct 05, 2022 at 01:33:53PM +0300, Felix Yan wrote: On 10/5/22 12:47, Bo YU wrote: hi, (maybe this is off topic on this list) When I want to run sphinx cmd on my pc, I got the error: ``` [...] line 883, in normalize return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_') File "/usr/lib/python3.10/re.py", line 209, in sub return _compile(pattern, flags).sub(repl, string, count) TypeError: expected string or bytes-like object ``` Looks like this: https://github.com/sphinx-doc/sphinx/issues/10339 I noticed it also but I did not remember use sphinx with rinohtype extension. Are you using the rinohtype extension too? The fact is that I am packaging the sphinxcontrib-ditaa[0] and I want to test it via pip3: ``` vimer@dev:~/build/rfs/packages/test_dir$ sudo pip3 install sphinxcontrib-ditaa Collecting sphinxcontrib-ditaa Using cached sphinxcontrib-ditaa-1.0.1.tar.gz (7.5 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [30 lines of output] Traceback (most recent call last): File "", line 2, in File "", line 34, in File "/tmp/pip-install-c2wygkxs/sphinxcontrib-ditaa_10e1c64028af47e59b8fc5bf20b6901c/setup.py", line 8, in setup( File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 86, in setup _install_setup_requires(attrs) File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 75, in _install_setup_requires dist = MinimalDistribution(attrs) File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 57, in __init__ super().__init__(filtered) File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 474, in __init__ for ep in metadata.entry_points(group='distutils.setup_keywords'): File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 1009, in entry_points return SelectableGroups.load(eps).select(**params) File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 459, in load ordered = sorted(eps, key=by_group) File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 1006, in eps = itertools.chain.from_iterable( File "/usr/lib/python3.10/importlib/metadata/_itertools.py", line 16, in unique_everseen k = key(element) File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 941, in _normalized_name return self._name_from_stem(stem) or super()._normalized_name File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 622, in _normalized_name return Prepared.normalize(self.name) File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 871, in normalize return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_') File "/usr/lib/python3.10/re.py", line 209, in sub return _compile(pattern, flags).sub(repl, string, count) TypeError: expected string or bytes-like object [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. ``` So I think the issue maybe not raised from sphinx extension, but it could be worse than that. Thanks for help:) [0]: https://pypi.org/project/sphinxcontrib-ditaa/ -- Regards, Felix Yan -- Regards, -- Bo YU signature.asc Description: PGP signature
Re: how to fix TypeError: expected string or bytes-like object ?
On 10/5/22 12:47, Bo YU wrote: hi, (maybe this is off topic on this list) When I want to run sphinx cmd on my pc, I got the error: ``` vimer@dev:~/build/rfs/packages/test_dir$ cat /tmp/sphinx-err-etgbo9tg.log # Sphinx version: 4.5.0 # Python version: 3.10.7 (CPython) # Docutils version: 0.17.1 release # Jinja2 version: 3.0.3 # Last messages: # Loaded extensions: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/sphinx/cmd/build.py", line 272, in build_main app = Sphinx(args.sourcedir, args.confdir, args.outputdir, File "/usr/lib/python3/dist-packages/sphinx/application.py", line 220, in __init__ self.preload_builder(buildername) File "/usr/lib/python3/dist-packages/sphinx/application.py", line 297, in preload_builder self.registry.preload_builder(self, name) File "/usr/lib/python3/dist-packages/sphinx/registry.py", line 142, in preload_builder builder_entry_points = entry_points(group='sphinx.builders') File "/usr/lib/python3/dist-packages/importlib_metadata/__init__.py", line 1047, in entry_points return SelectableGroups.load(eps).select(**params) File "/usr/lib/python3/dist-packages/importlib_metadata/__init__.py", line 477, in load ordered = sorted(eps, key=by_group) File "/usr/lib/python3/dist-packages/importlib_metadata/__init__.py", line 1044, in eps = itertools.chain.from_iterable( File "/usr/lib/python3/dist-packages/importlib_metadata/_itertools.py", line 16, in unique_everseen k = key(element) File "/usr/lib/python3/dist-packages/importlib_metadata/__init__.py", line 961, in _normalized_name or super()._normalized_name File "/usr/lib/python3/dist-packages/importlib_metadata/__init__.py", line 628, in _normalized_name return Prepared.normalize(self.name) File "/usr/lib/python3/dist-packages/importlib_metadata/__init__.py", line 883, in normalize return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_') File "/usr/lib/python3.10/re.py", line 209, in sub return _compile(pattern, flags).sub(repl, string, count) TypeError: expected string or bytes-like object ``` Looks like this: https://github.com/sphinx-doc/sphinx/issues/10339 Are you using the rinohtype extension too? -- Regards, Felix Yan OpenPGP_signature Description: OpenPGP digital signature
how to fix TypeError: expected string or bytes-like object ?
hi, (maybe this is off topic on this list) When I want to run sphinx cmd on my pc, I got the error: ``` vimer@dev:~/build/rfs/packages/test_dir$ cat /tmp/sphinx-err-etgbo9tg.log # Sphinx version: 4.5.0 # Python version: 3.10.7 (CPython) # Docutils version: 0.17.1 release # Jinja2 version: 3.0.3 # Last messages: # Loaded extensions: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/sphinx/cmd/build.py", line 272, in build_main app = Sphinx(args.sourcedir, args.confdir, args.outputdir, File "/usr/lib/python3/dist-packages/sphinx/application.py", line 220, in __init__ self.preload_builder(buildername) File "/usr/lib/python3/dist-packages/sphinx/application.py", line 297, in preload_builder self.registry.preload_builder(self, name) File "/usr/lib/python3/dist-packages/sphinx/registry.py", line 142, in preload_builder builder_entry_points = entry_points(group='sphinx.builders') File "/usr/lib/python3/dist-packages/importlib_metadata/__init__.py", line 1047, in entry_points return SelectableGroups.load(eps).select(**params) File "/usr/lib/python3/dist-packages/importlib_metadata/__init__.py", line 477, in load ordered = sorted(eps, key=by_group) File "/usr/lib/python3/dist-packages/importlib_metadata/__init__.py", line 1044, in eps = itertools.chain.from_iterable( File "/usr/lib/python3/dist-packages/importlib_metadata/_itertools.py", line 16, in unique_everseen k = key(element) File "/usr/lib/python3/dist-packages/importlib_metadata/__init__.py", line 961, in _normalized_name or super()._normalized_name File "/usr/lib/python3/dist-packages/importlib_metadata/__init__.py", line 628, in _normalized_name return Prepared.normalize(self.name) File "/usr/lib/python3/dist-packages/importlib_metadata/__init__.py", line 883, in normalize return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_') File "/usr/lib/python3.10/re.py", line 209, in sub return _compile(pattern, flags).sub(repl, string, count) TypeError: expected string or bytes-like object ``` The problem may be in importlib_metadata here, but I am not sure how to fix it. I remembered I do `python setup.py build/install` something ago. Any help is welcome! BR, Bo