Use regular 'w' mode when writing text files for py3 compatibility.
This commit is contained in:
@@ -164,7 +164,7 @@ class CommandJobTemplateExport:
|
||||
|
||||
encoded = job.Proxy.setupSheet.encodeTemplateAttributes(attrs)
|
||||
# write template
|
||||
with open(PathUtil.toUnicode(path), 'wb') as fp:
|
||||
with open(PathUtil.toUnicode(path), 'w') as fp:
|
||||
json.dump(encoded, fp, sort_keys=True, indent=2)
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
|
||||
@@ -299,7 +299,7 @@ class ToolLibraryManager():
|
||||
fext = os.path.splitext(name)[1].lower()
|
||||
if fext != ext:
|
||||
name = "{}{}".format(name, ext)
|
||||
return (open(PathUtil.toUnicode(name), 'wb'), name)
|
||||
return (open(PathUtil.toUnicode(name), 'w'), name)
|
||||
|
||||
if filename[1] == self.TooltableTypeXML:
|
||||
fp,fname = openFileWithExtension(filename[0], '.xml')
|
||||
|
||||
@@ -227,7 +227,7 @@ def export(objectslist, filename, argstring):
|
||||
print("done postprocessing.")
|
||||
|
||||
if not filename == '-':
|
||||
gfile = pythonopen(filename, "wb")
|
||||
gfile = pythonopen(filename, "w")
|
||||
gfile.write(final)
|
||||
gfile.close()
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ def export(obj,filename,argstring):
|
||||
gcode+= lineout(c, oldvals, modal)+'\n'
|
||||
oldvals = saveVals(c)
|
||||
gcode+='M2\n'
|
||||
gfile = open(filename,"wb")
|
||||
gfile = open(filename,"w")
|
||||
gfile.write(gcode)
|
||||
gfile.close()
|
||||
else:
|
||||
|
||||
@@ -179,7 +179,7 @@ def export(objectslist,filename,argstring):
|
||||
|
||||
print("done postprocessing.")
|
||||
|
||||
gfile = pythonopen(filename,"wb")
|
||||
gfile = pythonopen(filename,"w")
|
||||
gfile.write(final)
|
||||
gfile.close()
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ def export(objectslist, filename,argstring):
|
||||
print("the given object is not a path")
|
||||
gcode = obj.Path.toGCode()
|
||||
gcode = parse(gcode)
|
||||
gfile = pythonopen(filename, "wb")
|
||||
gfile = pythonopen(filename, "w")
|
||||
gfile.write(gcode)
|
||||
gfile.close()
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ def export(objectslist,filename,argstring):
|
||||
|
||||
print ("done postprocessing.")
|
||||
|
||||
gfile = pythonopen(filename,"wb")
|
||||
gfile = pythonopen(filename,"w")
|
||||
gfile.write(gcode)
|
||||
gfile.close()
|
||||
|
||||
|
||||
@@ -234,7 +234,7 @@ def export(objectslist, filename, argstring):
|
||||
print("done postprocessing.")
|
||||
|
||||
#write the file
|
||||
gfile = pythonopen(filename,"wb")
|
||||
gfile = pythonopen(filename,"w")
|
||||
gfile.write(gcode)
|
||||
gfile.close()
|
||||
|
||||
|
||||
@@ -223,7 +223,7 @@ def export(objectslist,filename,argstring):
|
||||
|
||||
print("done postprocessing.")
|
||||
|
||||
gfile = pythonopen(filename,"wb")
|
||||
gfile = pythonopen(filename,"w")
|
||||
gfile.write(gcode)
|
||||
gfile.close()
|
||||
|
||||
|
||||
@@ -231,7 +231,7 @@ def export(objectslist, filename, argstring):
|
||||
print("done postprocessing.")
|
||||
|
||||
if not filename == '-':
|
||||
gfile = pythonopen(filename, "wb")
|
||||
gfile = pythonopen(filename, "w")
|
||||
gfile.write(final)
|
||||
gfile.close()
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ def export(objectslist, filename, argstring):
|
||||
print("done postprocessing.")
|
||||
|
||||
# Write the output
|
||||
gfile = pythonopen(filename, "wb")
|
||||
gfile = pythonopen(filename, "w")
|
||||
gfile.write(final)
|
||||
gfile.close()
|
||||
|
||||
|
||||
@@ -531,6 +531,6 @@ def export(objectslist, filename, argstring):
|
||||
gcode += linenumberify(GCODE_FOOTER)
|
||||
if SHOW_EDITOR:
|
||||
PostUtils.editor(gcode)
|
||||
gfile = pythonopen(filename, "wb")
|
||||
gfile = pythonopen(filename, "w")
|
||||
gfile.write(gcode)
|
||||
gfile.close()
|
||||
|
||||
@@ -51,7 +51,7 @@ def export(objectslist, filename, argstring):
|
||||
for obj in objectslist:
|
||||
code += convertobject(obj)
|
||||
|
||||
gfile = pythonopen(filename,"wb")
|
||||
gfile = pythonopen(filename,"w")
|
||||
gfile.write(code)
|
||||
gfile.close()
|
||||
|
||||
|
||||
@@ -243,7 +243,7 @@ def export(objectslist, filename, argstring):
|
||||
else:
|
||||
|
||||
if not filename == '-':
|
||||
gfile = pythonopen(filename, "wb")
|
||||
gfile = pythonopen(filename, "w")
|
||||
gfile.write(final)
|
||||
gfile.close()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user