summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHossein <hossein@libreoffice.org>2021-09-02 14:31:42 +0200
committerHossein <hossein@libreoffice.org>2021-09-02 17:01:42 +0430
commit9fab31d1f5cfb6e054da87082f9e77d29e150c9b (patch)
tree0b45d37318666f98f52f78fdcf3caf4247edf7c7
parent926f5b3d21e97cbc659039aa7a03436e3826af0c (diff)
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.
-rwxr-xr-xemf-dump.py3
-rw-r--r--msodumper/emfrecord.py3
2 files changed, 2 insertions, 4 deletions
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):