From 8dde128b1c1f987dd2ec2a22d3b3265319c37be1 Mon Sep 17 00:00:00 2001 From: easyw Date: Fri, 19 Apr 2019 14:44:37 +0200 Subject: [PATCH] py3 compatibility fix --- src/Mod/Import/stepZ.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Mod/Import/stepZ.py b/src/Mod/Import/stepZ.py index 96fe1ea9ae..fdbe15c832 100644 --- a/src/Mod/Import/stepZ.py +++ b/src/Mod/Import/stepZ.py @@ -21,13 +21,15 @@ import PySide from PySide import QtGui, QtCore import tempfile -___stpZversion___ = "1.3.2" +___stpZversion___ = "1.3.3" if six.PY3: import gzip as gz + import builtins as builtin #py3 else: # six.PY2 import gzip_utf8 as gz + import __builtin__ as builtin #py2 # import stepZ; reload(stepZ); import gzip_utf8; reload(gzip_utf8) @@ -85,7 +87,8 @@ def open(filename): tempdir = tempfile.gettempdir() # get the current temporary directory tempfilepath = os.path.join(tempdir,fname + u'.stp') - with six.builtins.open(tempfilepath, 'wb') as f: #py3 + #with six.builtins.open(tempfilepath, 'wb') as f: #py3 + with builtin.open(tempfilepath, 'wb') as f: #py3 f.write(file_content) #ImportGui.insert(filepath) ImportGui.open(tempfilepath) @@ -110,7 +113,8 @@ def insert(filename,doc): tempdir = tempfile.gettempdir() # get the current temporary directory tempfilepath = os.path.join(tempdir,fname + u'.stp') - with six.builtins.open(tempfilepath, 'wb') as f: #py3 + # with six.builtins.open(tempfilepath, 'wb') as f: #py3 + with builtin.open(tempfilepath, 'wb') as f: #py3 f.write(file_content) ImportGui.insert(tempfilepath, doc) #ImportGui.open(tempfilepath)