py3 compatibility fix
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user