buriy / python-readability

fast python port of arc90's readability tool, updated to match latest readability.js!
https://github.com/buriy/python-readability
Apache License 2.0
2.67k stars 349 forks source link

RuntimeWarning and Correct invocation on the shell command line (not python script) #158

Open m040601 opened 3 years ago

m040601 commented 3 years ago

Thanks for your work maintaining and keeping this very usefull library up to date.

Could you please add a line to the README front page, describing the correct invocation of this library on the command line ?

Apologies if this may sound "obvious" to the developer, but I'm just an end user, not a python expert.

I use it a lot in shell scripts, not python scripts. For a long time I had just simply typed:

python -m readability -h

or

python -m readability -u https://someurl

Some time ago something changed, and I had to start invoking it like this

python -m readability.readability -u ...

But lately I can't get rid of this anoying error message, that gets output to STDERR

/usr/lib/python3.8/runpy.py:127: RuntimeWarning: readability.readability found in sys.modules after import of package readability, but prior to execution of readability.readability; this may result in unpredictable behaviour
  warn(RuntimeWarning(msg))

It still works, but then that STDERR "pollutes" my shell scripts execution. Tried googling for what it means, but my python skills are lacking.

I'm on Arch Linux, system python version 3.8.6, and I get python-readability library installed via this package, https://aur.archlinux.org/packages/python-readability-lxml. My system if of course up to date, and python wise I dont get any other problems.

I just cant understand if this error, is something intrinsic to this tool, my Python installation or the way I'm am calling this library on the command line.

Thanks in advance

buriy commented 3 years ago

Thanks a lot! We had command line usage, which was always "python -m readability.readability -u ...", I need to put it back to the docs (not sure why I removed it), but yes, it's python 3.8 who apparently doesn't like it. Even though it's just a warning, I'll fix it.