diff --git a/siphon/ncss.py b/siphon/ncss.py index 9685a06f2..2cc27654c 100644 --- a/siphon/ncss.py +++ b/siphon/ncss.py @@ -344,12 +344,12 @@ def parse_xml_dataset(elem, handle_units): @response_handlers.register('application/x-netcdf') @response_handlers.register('application/x-netcdf4') def read_netcdf(data, handle_units): # pylint:disable=unused-argument - osType = platform.architecture() - if osType[1].lower() == 'windowspe': + ostype = platform.architecture() + if ostype[1].lower() == 'windowspe': with NamedTemporaryFile(delete=False) as tmp_file: tmp_file.write(data) tmp_file.flush() - atexit.register(deletetempfile,tmp_file.name) + atexit.register(deletetempfile, tmp_file.name) return Dataset(tmp_file.name, 'r') else: with NamedTemporaryFile() as tmp_file: @@ -362,10 +362,11 @@ def read_netcdf(data, handle_units): # pylint:disable=unused-argument warnings.warn('netCDF4 module not installed. ' 'Will be unable to handle NetCDF returns from NCSS.') + def deletetempfile(fname): try: remove(fname) - except PermissionError: + except OSError: import warnings warnings.warn('temporary netcdf dataset file not deleted. ' 'to delete temporary dataset file in the future '