How to upload DXF file Successfully


I am having issues with uploading (and reading) a DXF file using the dash upload component.

My end goal is to get all the information from the drawing layers and pass it into a json file using:

  • the python package “ezdxf” and;
  • the package methods in “ezdxf” —> readlines() or read()

My starting code is to test if this works is to get the total number of layers in a DXF file and save it into a dash store component. However I am having trouble getting “ezdxf” to successfully read the contents from the upload component.

Appreciate if anyone has any ideas on this issue.


Similar issues here. I have done some trial and error with base64 package as well as the io python core package with no success. A little bit like the example given by plotly below for excel.

Same issue here!!!

I am trying to get the User to upload a dxf file, save it with a name in the server, and process it from there

Recipe for dcc.Upload is clear for images and excel or csv files… but how about other files… dxf???

thanks heaps in advance if anybody knows how?

I have found the magic formula at

def save_file(name, content):
    """Decode and store a file uploaded with Plotly Dash."""
    data = content.encode("utf8").split(b";base64,")[1]
    with open(os.path.join(UPLOAD_DIRECTORY, name), "wb") as fp: