I'm trying to use Streamlit to create an app that reads a .dxf file using ezdxf modifies it and allows a the user to download the modified file. What I'm having trouble with is getting ezdxf to read the uploaded file.
The error i'm getting from Streamlit is: FileNotFoundError: [Errno 2] No such file or directory:
With a traceback of:
File "/Users/Username/pythonProject/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
exec(code, module.__dict__)
File "/Users/Username/pythonProject/Adjust_thickness_app.py", line 53, in <module>
doc = ezdxf.readfile(uploaded_file)
File "/Users/Username/pythonProject/venv/lib/python3.9/site-packages/ezdxf/filemanagement.py", line 137, in readfile
if is_binary_dxf_file(filename):
File "/Users/Username/pythonProject/venv/lib/python3.9/site-packages/ezdxf/lldxf/validator.py", line 316, in is_binary_dxf_file
with open(filename, "rb") as fp:
I've tried various methods of parse the file once its been uploaded. According to what I understand from the documentation I should be able to use the file like normal once it's been uploaded using:
uploaded_file = st.file_uploader("Choose a .dxf file",type=['dxf'])
When I try to call it later in the script using:
doc = ezdxf.readfile(uploaded_file)
it throws the error.
Thanks!