When the WXR version is >1.1, the first loop iteration will try with a non-existent wpns and item.find('%spost_type' % wpns) is None, hence .text will raise an exception.
The WXR that I exported has all types of items, hence it's more flexible to assign the post type, then filter for post and page types later.
When the WXR version is >1.1, the first loop iteration will try with a non-existent
wpns
anditem.find('%spost_type' % wpns)
is None, hence.text
will raise an exception.The WXR that I exported has all types of items, hence it's more flexible to assign the post type, then filter for
post
andpage
types later.