[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

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 "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-c2wygkxs/sphinxcontrib-ditaa_10e1c64028af47e59b8fc5bf20b6901c/setup.py", line 8, in <module>
          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 <genexpr>
          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

Attachment: signature.asc
Description: PGP signature


Reply to: