We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent aa69d31 commit 91038f2Copy full SHA for 91038f2
swig/include/python/gdal_python.i
@@ -5558,7 +5558,8 @@ class VSIFile(BytesIO):
5558
return self.SetAsBoolean(value)
5559
if type == GAAT_STRING:
5560
if isinstance(value, int):
5561
- if "GDALDataType" in self.GetMetadataItem("type") and value >= GDT_Byte and value < GDT_TypeCount:
+ metadata_item = self.GetMetadataItem("type")
5562
+ if metadata_item and ("GDALDataType" in metadata_item) and value >= GDT_Byte and value < GDT_TypeCount:
5563
return self.SetAsString(GetDataTypeName(value))
5564
else:
5565
return self.SetAsString(str(value))
0 commit comments