-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
backcompat.py throws bs4 warning #105
Comments
Those warnings are generated by BeautifulSoup if it does not find the parser specified, which is what you seemed to have used directly. mf2py defaults to the user-specified parser or to html5lib. If neither works it just defers to BeautifulSoup. |
I don't understand your comment. I quoted the line in backcompat.py that creates a bs parser. "Deferring to BeautifulSoup" causes the warning. This warning is new, it's intended to get everyone to change their code to specify a parser to use. |
@wumpus Ah! yes sorry I got a bit confused. Will fix in the next update. Thanks! |
Thank you! |
self-note: possible resolution: put back the older code from Line 207 in 65c3699
BS documentation: https://www.crummy.com/software/BeautifulSoup/bs4/doc/#navigablestring-and-new-tag and recheck if the same html parser is then used with this change. |
After a bit more thinking here are possible ways to fix this each with some drawbacks
Not sure what the way out is. |
backcompat never paid any attention to the user-specified parser and it only parses that one string. I don't think adding a default of html5lib will cause any harm. |
@wumpus the trouble with that is if someone does not have html5lib installed it will throw an error and stop parsing. At least right now it only throws a warning but uses whatever parser it can find. |
ok then put a try/except block around it similar to your other code. (I have no idea what parsers are installed by default, etc.) |
spews:
Perhaps you want to use the same default as parser.py of 'html5lib' ?
Also parser.py has an except FeatureNotFound block that calls BeautifulSoup(doc) and will also generate this ugly warning.
The text was updated successfully, but these errors were encountered: