-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
These seem to cause errors when referencing them (but not when adding them)
For example:
Body Text First Indent 2"
Hang.5"
for sy in toReview.styles:
newstyle = outputDoc_styles.add_style(sy.name, sy.type) ##this works
newfont = outputDoc_styles[sy.name].font ##this crashes
Traceback (most recent call last):
...
File "/usr/local/lib/python3.4/dist-packages/docx/styles/styles.py", line 44, in getitem
style_elm = self._element.get_by_name(BabelFish.ui2internal(key))
File "/usr/local/lib/python3.4/dist-packages/docx/oxml/styles.py", line 343, in get_by_name
return self.xpath(xpath)[0]
File "/usr/local/lib/python3.4/dist-packages/docx/oxml/xmlchemy.py", line 751, in xpath
xpath_str, namespaces=nsmap
File "lxml.etree.pyx", line 1507, in lxml.etree._Element.xpath (src/lxml/lxml.etree.c:52198)
File "xpath.pxi", line 307, in lxml.etree.XPathElementEvaluator.call (src/lxml/lxml.etree.c:152124)
File "xpath.pxi", line 227, in lxml.etree._XPathEvaluatorBase._handle_result (src/lxml/lxml.etree.c:151097)
File "xpath.pxi", line 212, in lxml.etree._XPathEvaluatorBase._raise_eval_error (src/lxml/lxml.etree.c:150896)
lxml.etree.XPathEvalError: Invalid predicate
Anyways, I can work around this by changing the " to a ' with str.replace but maybe this is something that is easily fixed?