[gdal-dev] os.remove and os.unlink in the testsuite

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] os.remove and os.unlink in the testsuite

Ben Elliston
Hi Even

What do you think about adding some convenience functions to the
gdaltest module like "try_remove" and "try_unlink" that never throw an
exception if the file doesn't exist?  This would remove a lot of lines
like these from the test cases:

try:
  os.unlink('some file')
except OSError:
  pass

Cheers, Ben
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: os.remove and os.unlink in the testsuite

Even Rouault-2
On lundi 16 avril 2018 19:33:33 CEST Ben Elliston wrote:

> Hi Even
>
> What do you think about adding some convenience functions to the
> gdaltest module like "try_remove" and "try_unlink" that never throw an
> exception if the file doesn't exist?  This would remove a lot of lines
> like these from the test cases:
>
> try:
>   os.unlink('some file')
> except OSError:
>   pass
>

You can use gdal.Unlink(filename) and gdal.RmdirRecursive(dirname). They will
not throw any exception or error message.

Even

--
Spatialys - Geospatial professional services
http://www.spatialys.com
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev