Skip to content

Commit

Permalink
Bug fix: hasattr('len') --> hasattr('__len__')
Browse files Browse the repository at this point in the history
  • Loading branch information
bryan-harter committed Sep 13, 2023
1 parent 3b979fa commit 37c3ec1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cdflib/cdfwrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -2286,7 +2286,7 @@ def _convert_data(self, data_type: int, num_elems: int, num_values: int, indata:
odata = ""
if size >= 1:
for x in range(0, size):
if hasattr(indata, "len"):
if hasattr(indata, "__len__"):
adata = indata[x]
else:
adata = indata
Expand All @@ -2297,7 +2297,7 @@ def _convert_data(self, data_type: int, num_elems: int, num_values: int, indata:
elif isinstance(adata, np.ndarray):
size2 = adata.size
for y in range(0, size2):
if hasattr(adata, "len"):
if hasattr(adata, "__len__"):
bdata = adata[y]
else:
bdata = adata
Expand Down

0 comments on commit 37c3ec1

Please sign in to comment.