[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 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

Attachment: signature.asc
Description: PGP signature


Reply to: