elif recType == 2: #Extended Segment Address Record\r
extraAddr = int(line[9:13], 16) * 16\r
else:\r
- print recType, recLen, addr, checkSum, line\r
+ print(recType, recLen, addr, checkSum, line)\r
f.close()\r
return data
\ No newline at end of file
raise IspError("Chip with signature: " + str(self.getSignature()) + "not found")\r
self.chipErase()\r
\r
- print "Flashing %i bytes" % len(flashData)\r
+ print("Flashing %i bytes" % len(flashData))\r
self.writeFlash(flashData)\r
- print "Verifying %i bytes" % len(flashData)\r
+ print("Verifying %i bytes" % len(flashData))\r
self.verifyFlash(flashData)\r
\r
#low level ISP commands\r
raise ispBase.IspError("Timeout")\r
b = struct.unpack(">B", s)[0]\r
checksum ^= b\r
- #print hex(b)\r
+ #print(hex(b))\r
if state == 'Start':\r
if b == 0x1B:\r
state = 'GetSeq'\r
if os.path.dirname(name) == subpath:
filePaths.append(os.path.join(zipfilename, name))
z.close()
- print directoryName, filePaths
+ print(directoryName, filePaths)
return filePaths
def getFilePathsRecursively(fileInDirectory=''):
from fabmetheus_utilities.vector3 import Vector3
from fabmetheus_utilities import xml_simple_writer
-import cStringIO
+
+import sys
import math
import random
+if sys.version_info.major < 3:
+ import cStringIO
+else:
+ import io as cStringIO
__author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
__date__ = '$Date: 2008/21/04 $'
from fabmetheus_utilities.vector3 import Vector3
from fabmetheus_utilities import archive
from fabmetheus_utilities import euclidean
-import cStringIO
+
import math
import os
import sys
import traceback
+if sys.version_info.major < 3:
+ import cStringIO
+else:
+ import io as cStringIO
__author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
__date__ = '$Date: 2008/21/04 $'
info = getProfileInformation()
if not info.has_key(repository.name):
- print "Warning: Plugin: " + repository.name + " missing from Cura info"
+ print("Warning: Plugin: " + repository.name + " missing from Cura info")
return repository
info = info[repository.name]
for p in repository.preferences:
name = safeConfigName(p.name)
if not info.has_key(name):
- print "Setting: " + repository.name + ":" + name + " missing from Cura info"
+ print("Setting: " + repository.name + ":" + name + " missing from Cura info")
continue
if isinstance(info[name], types.FunctionType):
p.setValueToString(str(info[name](p)))
return repository
def printProgress(layerIndex, procedureName):
- print ("Progress[" + procedureName + ":" + str(layerIndex+1) + "]")
+ print("Progress[" + procedureName + ":" + str(layerIndex+1) + "]")
sys.stdout.flush()
def printProgressByNumber(layerIndex, numberOfLayers, procedureName):
- print ("Progress[" + procedureName + ":" + str(layerIndex+1) + ":" + str(numberOfLayers) + "]")
+ print("Progress[" + procedureName + ":" + str(layerIndex+1) + ":" + str(numberOfLayers) + "]")
sys.stdout.flush()
def getAlterationFileLines(fileName):
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
import __init__
-import cStringIO
+import sys
+
+if sys.version_info.major < 3:
+ import cStringIO
+else:
+ import io as cStringIO
__author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
cmdList = []
for filename in self.filelist:
idx = self.filelist.index(filename)
- print filename, idx
+ #print filename, idx
if idx > 0:
profile.setTempOverride('fan_enabled', 'False')
profile.setTempOverride('skirt_line_count', '0')
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.\r
import __init__\r
\r
-import ConfigParser, os, traceback, math, re, zlib, base64, time, sys\r
+import os, traceback, math, re, zlib, base64, time, sys\r
+if sys.version_info.major < 3:\r
+ import ConfigParser\r
+else:\r
+ import configparser as ConfigParser\r
\r
#########################################################\r
## Default settings when none are found.\r
if name in profileDefaultSettings:\r
default = profileDefaultSettings[name]\r
else:\r
- print "Missing default setting for: '" + name + "'"\r
+ print("Missing default setting for: '" + name + "'")\r
profileDefaultSettings[name] = ''\r
default = ''\r
if not globalProfileParser.has_section('profile'):\r
globalProfileParser.add_section('profile')\r
globalProfileParser.set('profile', name, str(default))\r
- #print name + " not found in profile, so using default: " + str(default)\r
+ #print(name + " not found in profile, so using default: " + str(default))\r
return default\r
return globalProfileParser.get('profile', name)\r
\r
if name in preferencesDefaultSettings:\r
default = preferencesDefaultSettings[name]\r
else:\r
- print "Missing default setting for: '" + name + "'"\r
+ print("Missing default setting for: '" + name + "'")\r
preferencesDefaultSettings[name] = ''\r
default = ''\r
if not globalPreferenceParser.has_section('preference'):\r
globalPreferenceParser.add_section('preference')\r
globalPreferenceParser.set('preference', name, str(default))\r
- #print name + " not found in preferences, so using default: " + str(default)\r
+ #print(name + " not found in preferences, so using default: " + str(default))\r
return default\r
return unicode(globalPreferenceParser.get('preference', name), "utf-8")\r
\r
if filename in alterationDefault:\r
default = alterationDefault[filename]\r
else:\r
- print "Missing default alteration for: '" + filename + "'"\r
+ print("Missing default alteration for: '" + filename + "'")\r
alterationDefault[filename] = ''\r
default = ''\r
if not globalProfileParser.has_section('alterations'):\r
globalProfileParser.add_section('alterations')\r
- #print "Using default for: %s" % (filename)\r
+ #print("Using default for: %s" % (filename))\r
globalProfileParser.set('alterations', filename, default)\r
return unicode(globalProfileParser.get('alterations', filename), "utf-8")\r
\r
}
totalRunTimeFactor = 0
-for v in sliceStepTimeFactor.itervalues():
+for v in sliceStepTimeFactor.values():
totalRunTimeFactor += v
def getPyPyExe():
skeinforge_craft.writeOutput(fileName)
elif pypyExe == False:
if not hasattr(sys, 'frozen'):
- print "************************************************"
- print "* Failed to find pypy, so slicing with python! *"
- print "************************************************"
+ print("************************************************")
+ print("* Failed to find pypy, so slicing with python! *")
+ print("************************************************")
skeinforge_craft.writeOutput(fileName)
- print "************************************************"
- print "* Failed to find pypy, so sliced with python! *"
- print "************************************************"
+ print("************************************************")
+ print("* Failed to find pypy, so sliced with python! *")
+ print("************************************************")
else:
- print "******************************************************************"
- print "* Failed to find pypy, we need pypy to slice with a frozen build *"
- print "* Place pypy in the same directory as Cura so Cura can find it. *"
- print "******************************************************************"
+ print("******************************************************************")
+ print("* Failed to find pypy, we need pypy to slice with a frozen build *")
+ print("* Place pypy in the same directory as Cura so Cura can find it. *")
+ print("******************************************************************")
sys.exit(1)
else:
subprocess.call(getSliceCommand(fileName))
else:
mainScriptFile = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", os.path.split(sys.argv[0])[1]))
cmd = [pypyExe, mainScriptFile, '-p', profile.getGlobalProfileString()]
- cmd.append(filename)
+ if platform.system() == "Windows":
+ cmd.append(str(filename))
+ else:
+ cmd.append(filename)
return cmd
if __name__ == '__main__':
for filename in sys.argv[1:]:
m = stlModel().load(filename)
- print "Loaded %d faces" % (len(m.faces))
+ print("Loaded %d faces" % (len(m.faces)))
parts = m.splitToParts()
for p in parts:
saveAsSTL(p, "export_%i.stl" % parts.index(p))
curPath = [p]
paths.append(curPath)
i = 0
- print param
+ print(param)
while i < len(param):
endPoint = p + complex(param[i+5], -param[i+6])
addArc(curPath, p, endPoint, param[i], param[i+1], param[i+2], param[i+3], param[i+4])
elif cmd == 'Z' or cmd == 'z':
curPath.append(curPath[0])
elif cmd != None:
- print cmd
+ print(cmd)
cmd = c
param = []
return paths
tree.insert(AABB(Vector3(0,0,0), Vector3(0,0,0)))
tree.insert(AABB(Vector3(1,1,1), Vector3(1,1,1)))
tree.insert(AABB(Vector3(0.5,0.5,0.5), Vector3(0.5,0.5,0.5)))
- print tree
- print tree.query(AABB(Vector3(0,0,0), Vector3(0,0,0)))
+ print(tree)
+ print(tree.query(AABB(Vector3(0,0,0), Vector3(0,0,0))))
return "?"
if __name__ == '__main__':
- print getVersion()
+ print(getVersion())