Skip to content
This repository has been archived by the owner on Jun 3, 2020. It is now read-only.

Migrating to python 3 #76

Open
AForteCellenza opened this issue Jul 4, 2019 · 1 comment
Open

Migrating to python 3 #76

AForteCellenza opened this issue Jul 4, 2019 · 1 comment

Comments

@AForteCellenza
Copy link

Hi,

I'm trying to make a python 3 version of this module. But i got a little problem replacing XMLtreeBuilder by XMLParser in this class:

`class ns_tracker_tree_builder(XMLParser):

def __init__(self):
    XMLParser.__init__(self)
    self._parser.StartNamespaceDeclHandler = self._start_ns
    self.namespaces = {}

def _start_ns(self, prefix, ns):
    self.namespaces[prefix] = '{' + ns + '}'`

I get this error:

Traceback (most recent call last):
File "exitwp.py", line 374, in
data = parse_wp_xml(wpe)
File "exitwp.py", line 83, in parse_wp_xml
parser = ns_tracker_tree_builder()
File "exitwp.py", line 65, in init
self._parser.StartNamespaceDeclHandler = self._start_ns
AttributeError: 'ns_tracker_tree_builder' object has no attribute '_parser'

regards,

@omajid
Copy link

omajid commented May 10, 2020

I have a PR with the fix (for a hugo-based fork though), here: https://github.com/wooni005/exitwp-for-hugo/pull/4/files#diff-07a925cb3868c2d0586bbc2bba16a16dR64

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants