daily pastebin goal
88%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 57 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. with NamedTemporaryFile(suffix='.shp').name as tmp_shp:
  2.     df.to_file(tmp_shp)
  3.    
  4. with NamedTemporaryFile(suffix='.shp') as tmp_shp:
  5.     df.to_file(tmp_shp.name)  # Access .name here, assuming you need a str
  6.    
  7. tmp_shp = None
  8. try:
  9.     with NamedTemporaryFile(suffix='.shp', delete=False) as tmp_shp:
  10.  
  11.         df.to_file(tmp_shp.name)  # Access .name here, assuming you need a str
  12.  
  13.         ... do any other stuff with the file ...
  14. finally:
  15.     if tmp_shp is not None:
  16.         os.remove(tmp_shp.name)
  17.    
  18. with NamedTemporaryFile(suffix='.shp') as tmp_shp:
  19.     df.to_file(tmp_shp)
  20.    
  21. with NamedTemporaryFile(suffix='.shp') as tmp_file:
  22.     df.to_file(tmp_file)  # As temp_file is a file object, I think to_file should work?
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top