[Libreoffice-commits] mso-dumper.git: emf-dump.py msodumper/emfrecord.py
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Sep 2 12:35:57 UTC 2021
emf-dump.py | 3 ---
msodumper/emfrecord.py | 3 ++-
2 files changed, 2 insertions(+), 4 deletions(-)
New commits:
commit 9fab31d1f5cfb6e054da87082f9e77d29e150c9b
Author: Hossein <hossein at libreoffice.org>
AuthorDate: Thu Sep 2 14:31:42 2021 +0200
Commit: Hossein <hossein at libreoffice.org>
CommitDate: Thu Sep 2 17:01:42 2021 +0430
Fix emf-dump to work with Python 3.8
Using update() method instead of + operator for dict items
After running with
/opt/libreoffice7.2/program/python ./emf-dump.py test.emf
This error was shown:
Traceback (most recent call last):
File "./emf-dump.py", line 8, in <module>
from msodumper import emfrecord
File "msodumper/emfrecord.py", line 139, in <module>
HatchStyle = dict(wmfrecord.HatchStyle.items() + EmfHatchStyle.items())
TypeError: unsupported operand type(s) for +: 'dict_items' and 'dict_items'
Also, in Python 3, the default encoding is utf-8, so using
sys.setdefaultencoding("utf-8") is not needed/encouraged.
diff --git a/emf-dump.py b/emf-dump.py
index c40f101..614156a 100755
--- a/emf-dump.py
+++ b/emf-dump.py
@@ -7,9 +7,6 @@
from msodumper import emfrecord
import sys
-sys = reload(sys)
-sys.setdefaultencoding("utf-8")
-
class EMFDumper:
def __init__(self, filepath):
diff --git a/msodumper/emfrecord.py b/msodumper/emfrecord.py
index 59424c0..61b7eb6 100644
--- a/msodumper/emfrecord.py
+++ b/msodumper/emfrecord.py
@@ -136,7 +136,8 @@ EmfHatchStyle = {
0x000A: "HS_SOLIDBKCLR",
0x000B: "HS_DITHEREDBKCLR"
}
-HatchStyle = dict(wmfrecord.HatchStyle.items() + EmfHatchStyle.items())
+HatchStyle = dict(wmfrecord.HatchStyle.items())
+HatchStyle.update(dict(EmfHatchStyle.items()))
class LogBrushEx(EMFRecord):
More information about the Libreoffice-commits
mailing list