0

i try to add geometry layer to my gis app from shb layer i use Django for doing that and for uploading file i use serializer FileField now my main question is How can i save temporary file to my system in python is there any way to do that?

if there is please help me about that

  • 1
    Hi Emad, take a look at the build in [tempfile](https://docs.python.org/3/library/tempfile.html) library. I think this should do what you want. – Thymen Jan 30 '23 at 13:52

1 Answers1

0

Here is a similar question that has already been answered.

TL/DR

import tempfile

with tempfile.NamedTemporaryFile(mode="w", delete=False) as f:
    f.write("hello world")

path_to_tempfile = f.name
sur0k
  • 334
  • 1
  • 6