readtime icon indicating copy to clipboard operation
readtime copied to clipboard

[Error] Emoji in markdown

Open guedesfelipe opened this issue 1 year ago • 6 comments

Config:

  • macos
  • python 3.10.5
  • lxml 4.9.1
  • beautifulsoup4 4.11.1
  • pyquery 1.4.3

Error in tag.text: https://github.com/alanhamlett/readtime/blob/7efe13b6fb9598d28285d5add762f0638cccde4c/readtime/utils.py#L105

image

I don't know why, but only with this configuration the error appears. I with python 3.8 and 3.9 works perfectly.

More infos you can see here

guedesfelipe avatar Jul 06 '22 23:07 guedesfelipe

Strange that it works with Python 3.10 on Linux but fails on Mac in your tests. Maybe it's a bug in how we open/read the test files on Mac, or maybe it's a bug in lxml on Mac.

alanhamlett avatar Jul 07 '22 14:07 alanhamlett

Yes, I think it's bug in lxml 4.9.1 with macOS and python 3.10 and I don't know why this error apear only with this configuration.

guedesfelipe avatar Jul 09 '22 01:07 guedesfelipe

@guedesfelipe, since you're comparing 3.10 with Python 3.8 and 3.9, did you download and install all three from the same place? Are all three using lxml 4.9.1, installed from the official wheels? If you're unsure, maybe you can retry this with clean venvs and check during the package installation that that's the case. It's CPython doing the decoding here, so I would like to rule out distribution specific differences.

scoder avatar Jul 10 '22 07:07 scoder

did you download and install all three from the same place?

Yes, he's using the actions/setup-python GitHub action with the python version matrix here:

https://github.com/guedesfelipe/readtime_cli/blob/0ac78114cb2358664a41ecd372b58a1ecf95df12/.github/workflows/ci.yml#L45

Are all three using lxml 4.9.1, installed from the official wheels?

Yes, lxml is installed with pip so it's using the official wheel since pip prefers wheel over source installs when selecting install candidates.

alanhamlett avatar Jul 10 '22 21:07 alanhamlett

Ok, this is because of https://bugs.launchpad.net/lxml/+bug/1980575.

I removed the Py3.10 macOS wheel from PyPI because it was built incorrectly, so pip now does a source build for Py3.10. This apparently leads to issues like this on GHA/macOS.

The macOS build of lxml is generally unmaintained and therefore the wheels provided as they are, without support. PRs are welcome to improve the situation, specifically to provide correct wheels on Py3.10 again.

scoder avatar Jul 11 '22 17:07 scoder

Are all three using lxml 4.9.1, installed from the official wheels?

Yes, lxml is installed with pip so it's using the official wheel since pip prefers wheel over source installs when selecting install candidates.

Ah, that's the difference then. The macOS binary wheel for 3.10 has been found to be built incorrectly and removed from PyPI. Pip therefore builds its own local version, using suboptimal libraries (or whatever makes the difference here).

It's currently unclear when a replacement can be provided for Py3.10 since no affected macOS user has stepped up yet to fix the build. So the situation may remain as it is for a while.

scoder avatar Oct 11 '22 08:10 scoder