cannot open workbooks generated with python 2.6.x on windows
Since the namespace changes (I think) I'm having trouble opening workbooks generated by openpyxl with python 2.6, but it works fine on python 2.7.
This only occurs on Windows as far as I know, I attached workbooks generated on the same machine, with the same version of openpyxl (1.8.3) using different python versions. You can clearly see a difference in generated XML between 2.6.x and 2.7.
Comments (12)
-
-
It's using ElementTree. LXML is present on the machine, but not used as it's version 2.6 I think.
-
When you say "you can clearly see" I think you mean "in workbook.xml you can clearly see". It looks like the namespace registration isn't working as expected - this doesn't exist in ElementTree in Python 2.6. The error should occur on all platforms. Can you confirm that this is where it's happening by installing a more recent version of LXML on that machine?
-
I think the problem is quite simply that our version of
register_namespace
has never actually registered any namespaces with whichever version ofElementTree
is in use. -
I reproduce under linux too now. That's weird, didn't have issues before the namespace changes. I'm still trying to have LXML installed on the machine to confirm the bug.
-
I guess we never previous made use of registered namespaces. I think I've found the problem and can make it go away.
-
@Eric Gazoni I think this is fixed in the 1.8 branch. Can you try it?
-
Yep, this solves the issue ! Thanks a lot, I wouldn't have found an elegant solution like this it myself ;-)
-
hm, the fix itself is easy enough! It looks like Fredrik's suggestion was never properly done - it just assigns namespaces to module local! The hard part was working out how to test as the nolxml-py26 profile which is designed for this does not work properly in 1.8!
-
- changed status to resolved
-
- removed version
Removing version: 1.8.x (automated comment)
-
- removed component
Removing component: writer (automated comment)
- Log in to comment
Were they generated with LXML or ElementTree?