Closed stevenplatt closed 2 years ago
What is your python version? (I think the culprit is __init__.py
handling that has changed in python 3.10)
The typical use to avoid this is
from readability.readability import Document
On the Mac I am python version 3.8.9 (Mac OS Monterey). I tried from readability.readability import Document
, but this returns a different error for not finding a module with name readability
.
Stevens-MacBook-Pro:~ steven$ python3 --version
Python 3.8.9
I tried running on a Ubuntu 20.04 ARM VM (Running in Parallels on M1 mac) - it works as normal with no issue:
parallels@ubuntu-linux-20-04-desktop:~$ python3 --version
Python 3.8.10
I don't know enough about the python version difference to track down the culprit (and was planning to install into an ubuntu Docker container for my use). I am ok to close this one, if you don't have an M1 Mac test system. What do you think?
python3
Python 3.8.10 (default, Mar 15 2022, 12:22:08)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import readability
>>> d=readability.Document(input='hello world')
It works. So please ensure you don't have a local file named "readability.py" , this is the most typical explanation of this error.
You are correct, sorry about that. I indeed had a file with readability.py
on my local machine. After removing that files, all is working as normal on M1 Mac. Thank you for helping.
When installing the python-readability package via pip, the following import error is returned during use:
ImportError: cannot import name 'Document' from partially initialized module 'readability' (most likely due to a circular import)
I am using the following lines from the example snippet from the repo readme:
I am using an M1 mac for the installation. The prior releases at pypi appears to have dependencies for an older version of python, so I was unable to test with the older releases.