Skip to content

Commit

Permalink
path_script py3-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
looooo authored and wwmayer committed Jun 26, 2017
1 parent 27aaaf7 commit 4b2c5f5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Mod/Path/PathScripts/PathToolController.py
Expand Up @@ -29,7 +29,7 @@
import Path
import PathScripts
import PathScripts.PathLog as PathLog
import PathUtils
from . import PathUtils
import xml.etree.ElementTree as xml

from FreeCAD import Units
Expand Down Expand Up @@ -246,7 +246,7 @@ def Create(jobname=None, assignViewProvider=True, tool=None, toolNumber=1):
tool.CuttingEdgeHeight = 15.0
tool.ToolType = "EndMill"
tool.Material = "HighSpeedSteel"
obj.Tool = tool
obj.Tool = tool
obj.ToolNumber = toolNumber
PathUtils.addToJob(obj, jobname)

Expand Down

3 comments on commit 4b2c5f5

@looooo
Copy link
Contributor Author

@looooo looooo commented on 4b2c5f5 Jun 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why, but the relative import does not work with python2.
regarding: http://python-future.org/compatible_idioms.html#imports-relative-to-a-package it should work for python2 and 3.

problem can be reproduced this way:

>>> from PathScripts import PathUtils
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/home/lo/conda/conda-bld/freecad_debug_1498199239621/work/Mod/Path/PathScripts/PathUtils.py", line 31, in <module>
    from PathScripts import PathJob
  File "/home/lo/conda/conda-bld/freecad_debug_1498199239621/work/Mod/Path/PathScripts/PathJob.py", line 30, in <module>
    import PathScripts.PathToolController as PathToolController
  File "/home/lo/conda/conda-bld/freecad_debug_1498199239621/work/Mod/Path/PathScripts/PathToolController.py", line 32, in <module>
    from . import PathUtils
ImportError: cannot import name PathUtils

seems to be a circular import, maybe python2 has a problem with this.

@wwmayer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me it doesn't work with Py3 either.

@looooo
Copy link
Contributor Author

@looooo looooo commented on 4b2c5f5 Jun 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FreeCAD --run-test 0 still has some problems but the import statement worked for me (py3.6):
from PathScripts import PathUtils
but anyway @sliptonic has solved it with a recent PR: 835026d

Please sign in to comment.