I cant run ezdxf,

Question:

i just try to use ezdxf, and copied that code from ezdxf website:

import ezdxf
doc = ezdxf.new('R12', setup=True)
msp = doc.modelspace()
msp.add_text("A Simple Text").set_pos((2, 3), align='MIDDLE_RIGHT')
msp.add_text("Text Style Example: Liberation Serif",
             dxfattribs={
                 'style': 'LiberationSerif',
                 'height': 0.35}
             ).set_pos((2, 6), align='LEFT')
doc.saveas("simple_text.dxf")

and i recieve that:

AttributeError: partially initialized module ‘ezdxf’ has no attribute ‘new’ (most likely due to a circular import)

what may by wrong? installation, path,…

Asked By: Kolkornik

||

Answers:

Did you name your file the same thing as the module (in this case, ezdxf.py)? This causes problems with circular imports. Renaming the file should solve it.

Answered By: Lyndon Gingerich

For my case, in addition to the point mentioned in the other answer above; I had a python file named ‘ezdxf’ in the folder which I had my python test file was saved. This caused issues calling local file instead of the library files, when importing the library.

Answered By: enthu
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.