- changed title to No module named 'ezdxf.math.vector' [Beta branch]
No module named 'ezdxf.math.vector' in v8.994 BETA - fixed for next version
The progam fails to start with ezdxf version 0.15 and throws the following error
$ flatcam
Traceback (most recent call last):
File "/opt/flatcam/FlatCAM.py", line 6, in <module>
from app_Main import App
File "/opt/flatcam/app_Main.py", line 52, in <module>
from appDatabase import ToolsDB2
File "/opt/flatcam/appDatabase.py", line 4, in <module>
from camlib import to_dict
File "/opt/flatcam/camlib.py", line 54, in <module>
from appParsers.ParseDXF import *
File "/opt/flatcam/appParsers/ParseDXF.py", line 10, in <module>
from ezdxf.math.vector import Vector as ezdxf_vector
ModuleNotFoundError: No module named 'ezdxf.math.vector'
It seems that the class “ezdxf.math.vector.Vector” has been renamed to “ezdxf.math.Vec3“ according to the changelog (https://github.com/mozman/ezdxf/blob/master/NEWS.md)
I think that a simple way to fix this, keeping the backward compatibility with the older versions of ezdxf, is to change the line 10 of the file appParsers/ParseDXF.py
from
from ezdxf.math.vector import Vector as ezdxf_vector
to
try:
from ezdxf.math.vector import Vector as ezdxf_vector
except ImportError:
from ezdxf.math import Vec3 as ezdxf_vector
Comments (8)
-
reporter -
reporter - changed title to No module named 'ezdxf.math.vector' in v8.994 BETA
-
Hi Maurizio,
As far as I can see the latest version of ezdxf is 0.14.2 but there is a beta2 version of edxf 0.15.
Thank you for the report and for the code suggestion but I will wait until the final version of ezdxf 0.15 is released. In case there are other changes.Best regards,
Marius -
The new version of ezdxf is out.
As of the ezdxf Version 0.15 - 2020-12-30, we have the following message:
ModuleNotFoundError: No module named 'ezdxf.math.vector'
This is due to:
- CHANGE: renamed
ezdxf.math.Vector
toVec3
, butVector
remains as synonym
See https://ezdxf.mozman.at/release-v0-15.html
The code says
from ezdxf.math.vector import Vector as ezdxf_vector
But this way, the synonym does not work.
The code should probably be changed to:
from ezdxf.math import Vector as ezdxf_vector
That has the advantage of being also compatible with older versions of the lib. (in fact, there is no
ezdxf.math.vector
, even in older versions)But the try/catch as proposed above also works of course.
- CHANGE: renamed
-
Issue
#480was marked as a duplicate of this issue. -
Thank you all!
I’ve made the changes in my working copy, the changes will be made available on the 8.995 release. -
Cheers for the suggested fix, got me up and running
-
- Log in to comment