Porting to python3
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: Porting to python3
qt5 didn't introduce any conflicts by now. Geom2d and extensions made some problems. And there is this stupid generator problem, which already was there in the py3-20 branch.
Re: Porting to python3
The problem with the generators is, that the ...PyImp.cpp is empty when generated with python3. This is only for files that do not exist in the src dir. eg PropertySheetPyImp.cpp in Mod/Spreadsheet/App. There must be anything wrong in the place where these files got generated.
Re: Porting to python3
never give up, looking for the bug
https://github.com/looooo/FreeCAD/commi ... eb8556ed4b
https://github.com/looooo/FreeCAD/commi ... eb8556ed4b
Re: Porting to python3
regarding the exec error on travis:
this seems to be a conflict only with a specific python version (2.7.6) My system uses 2.7.12 and there is no error with the exec() function.
this seems to be a conflict only with a specific python version (2.7.6) My system uses 2.7.12 and there is no error with the exec() function.
Re: Porting to python3
The original line of generatetools.py is:
which for the Python3 port turned into:
IMO this is not what the original code is supposed to do. I think it should be set to
Code: Select all
exec stat in self.globals,self.locals
Code: Select all
exec(stat, self.globals, self.locals)
Code: Select all
exec (stat) in self.globals,self.locals
Re: Porting to python3
regarding this document it's fine like we have it right now:
http://www.diveintopython3.net/porting- ... .html#exec
but I will try if it solves the travis issue.
http://www.diveintopython3.net/porting- ... .html#exec
but I will try if it solves the travis issue.
Re: Porting to python3
python3 is building again! there was also a list of little python errors written at the end of the build-process. Maybe someone has the time to fix this. I think most of them can be fixed directly in the master.
Code: Select all
compiling .pyc files...
File "Mod/Fem/importZ88Mesh.py", line 389
print elem_length
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Path/PathScripts/PathSanity.py", line 53
print "Checking: " + item.Label
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Path/PathScripts/PathDressup.py", line 93
print i.Group
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Path/PathScripts/PathPostProcessor.py", line 38
exec "import %s as current_post" % postname
^
SyntaxError: Missing parentheses in call to 'exec'
File "Mod/Path/PathScripts/dynapath_post.py", line 117
print "the object " + obj.Name + " is not a path. Please select only path and Compounds."
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Path/PathScripts/PathUtils.py", line 622
print form.cboProject.currentText()
^
SyntaxError: invalid syntax
File "Mod/Path/PathScripts/generic_post.py", line 288
print "the object " + obj.Name + " is not a path. Please select only path and Compounds."
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Arch/ArchStructure.py", line 854
print "got ",objName
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Spreadsheet/importXLSX.py", line 370
print 'process Strings: '
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Path/PathScripts/dumper_post.py", line 55
print "the object " + obj.Name + " is not a path. Please select only path and Compounds."
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Path/PathScripts/linuxcnc_post.py", line 118
print "the object " + obj.Name + " is not a path. Please select only path and Compounds."
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Material/MaterialEditor.py", line 251
print "DrawingPatterns not found"
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Part/BOPTools/GeneralFuseResult.py", line 113
extractor = lambda(sh):(
^
SyntaxError: invalid syntax
File "Mod/Path/PathScripts/PathToolLibraryManager.py", line 264
print "Written ", filename[0]
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Arch/importIFC.py", line 618
print "failed to compute placement ",
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Path/PathScripts/PathDressupDragknife.py", line 454
print i.Group
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Arch/import3DS.py", line 109
print "Skipping object without vertices array: ",d_nobj.obj
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Fem/FemMesh2Mesh.py", line 134
print 'found a last Face: ', faceCodeList[actFaceIdx]
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Arch/ArchCommands.py", line 444
print "getShapeFromMesh: error building face from polygon"
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Arch/ArchSite.py", line 409
print "Error computing areas for ",obj.Label
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Path/PathScripts/example_post.py", line 45
print "This script is unable to write more than one Path object"
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Path/PathScripts/PathDrilling.py", line 307
print baselist
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Arch/ArchSchedule.py", line 351
print "successfully exported ",filename[0]
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Path/PathScripts/PathCompoundExtended.py", line 60
print 'check order'
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Arch/Dice3DS/dom3ds.py", line 297
except (File3dsFormatError, FBufError), fe:
^
SyntaxError: invalid syntax
File "Mod/Arch/importSH3D.py", line 123
if DEBUG: print "Creating wall: ",name
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Arch/ArchSectionPlane.py", line 100
print section.Label,": Skipping invalid object:",o.Label
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Path/PathScripts/PathSurface.py", line 148
print " loop ", nloop, " with ", len(loop), " points"
^
SyntaxError: invalid syntax
File "Mod/Fem/FemToolsZ88.py", line 104
print z88_std_location
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Path/PathScripts/opensbp_post.py", line 84
print s
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Path/PathScripts/centroid_post.py", line 88
print "No machine found in this selection"
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Path/PathScripts/PathMillFace.py", line 214
print "in execute"
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Path/PathScripts/PathPost.py", line 193
print "in activated %s" %(selected)
^
SyntaxError: invalid syntax
File "Mod/Part/BOPTools/ShapeMerge.py", line 53
1: (lambda(sh): sh.Vertexes),
^
SyntaxError: invalid syntax
File "Mod/Path/PathScripts/PathDressupDogbone.py", line 947
print i.Group
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Path/PathScripts/PathPocket.py", line 157
print "this base is: " + str(baselist)
^
SyntaxError: invalid syntax
File "Mod/Path/PathScripts/PathKurveUtils.py", line 144
print "in profile: 151"
^
SyntaxError: Missing parentheses in call to 'print'
File "Mod/Arch/ArchComponent.py", line 575
print "Debug: Error computing areas for ",obj.Label,": normalAt() Face ",i
^
SyntaxError: invalid syntax
File "Mod/Path/PathScripts/opensbp_pre.py", line 84
print "preprocessing..."
Re: Porting to python3
I should have listen to yorik. Once the rebase is done there are merge conflicts all over again... thats a bit frustrating.
Re: Porting to python3
This doesn't work with python3. I reset to the old method. To solve the travis-problem we should try to use a newer version of python2 on travis.wmayer wrote:IMO this is not what the original code is supposed to do. I think it should be set to
Code: Select all
exec (stat) in self.globals,self.locals
To make it possible to build the python3 branch on travis we need all the dependencies first available. Most of them should be available, but I think we have to make a ubuntu-package for python3-pivy. It should be also possible to make the package with pip. This is maybe the easier way. Maybe we can discuss this here.
The python3 branch needs tester. I will upload packages from this branch for python2 and python3 to anaconda in the next days. So testing is as easy as installing a conda package... (at least on linux64).
Once the python2 part of the branch works, I would vote for merging the branch. We can resolve all the little python3 errors (print) in the master branch.
(Only my opinion. Feel free to discuss this here)
Re: Porting to python3
Not? I tried it with a Python3.4 and it didn't complain.This doesn't work with python3.
Too many things have changed in the meantime so that a merge might be too troublesome. I would vote for an integration step-by-step. Therefore I would start with simple stuff like tabs to space conversions, parenthesis for print statements and so on, i.e. things that work with Python 2 and 3.Once the python2 part of the branch works, I would vote for merging the branch. We can resolve all the little python3 errors (print) in the master branch.
(Only my opinion. Feel free to discuss this here)