Am .11.2018, 02:08 Uhr, schrieb Chevell Parker <
chevell...@gmail.com>:
> Hello Charlie,
>
> The version of openpyxl installed on this machine is 2.4.1 and the
> version of link is (3, 7, 2, 0). Thanks again!
Okay. FWIW you're not on the most recent version of openpyxl, that's
2.5.12 which I released yesterday which, amongst other things, will use
defusedxml if it's installed but that's not your case.
You can work around the issue by setting an environment variable
OPENPYXL_LXML to False as the problem is related to lxml only: see
https://bugs.launchpad.net/bugs/1805888 for further details. And, as long
as you are not working with really large workbooks, this is probably the
easiest thing to do apart from passing the files through Excel.
Alternatively you can monkey patch openpyxl:
--- a/openpyxl/xml/functions.py Thu Nov 29 12:53:49 2018 +0100
+++ b/openpyxl/xml/functions.py Fri Nov 30 10:37:30 2018 +0100
@@ -133,5 +133,7 @@
NS_REGEX = re.compile("({(?P<namespace>.*)})?(?P<localname>.*)")
def localname(node):
+ if callable(node.tag):
+ return "comment"
m = NS_REGEX.match(node.tag)
return m.group('localname')
This is harmless, but it isn't pretty and not the sort of thing I'd like
to have in the library and this is the first time I've come across the
issue. If possible I'd suggest to whoever is responsible for the
application that is generating this that the switch to using custom
properties which are designed for this kind of annotation.