View Single Post
Old 01-15-2019, 06:43 AM   #5
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,736
Karma: 24031401
Join Date: Dec 2010
Device: Kindle PW2
@thiago.eec Note that Calibre comes with BeautifulSoup 3.0.5. (The current version is 4.4.)

For BeautifulSoup 3.0.5 you'll have to slightly change your code:

Code:
from calibre.ebooks.BeautifulSoup import BeautifulSoup
snippet = '"<section xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" epub:type="epigraph">"'
soup = BeautifulSoup(snippet)
if soup.section.has_key('epub:type'):
    epub_type = soup.section['epub:type']

Last edited by Doitsu; 01-15-2019 at 08:52 AM.
Doitsu is offline   Reply With Quote