Catch ValueError instead of base exception
This commit is contained in:
@ -1393,7 +1393,7 @@ class lammps(object):
|
|||||||
id_lmp = (self.c_tagint*n)()
|
id_lmp = (self.c_tagint*n)()
|
||||||
try:
|
try:
|
||||||
id_lmp[:] = id[0:n]
|
id_lmp[:] = id[0:n]
|
||||||
except: # lgtm [py/catch-base-exception]
|
except ValueError:
|
||||||
return 0
|
return 0
|
||||||
else:
|
else:
|
||||||
id_lmp = None
|
id_lmp = None
|
||||||
@ -1401,21 +1401,21 @@ class lammps(object):
|
|||||||
type_lmp = (c_int*n)()
|
type_lmp = (c_int*n)()
|
||||||
try:
|
try:
|
||||||
type_lmp[:] = type[0:n]
|
type_lmp[:] = type[0:n]
|
||||||
except: # lgtm [py/catch-base-exception]
|
except ValueError:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
three_n = 3*n
|
three_n = 3*n
|
||||||
x_lmp = (c_double*three_n)()
|
x_lmp = (c_double*three_n)()
|
||||||
try:
|
try:
|
||||||
x_lmp[:] = x[0:three_n]
|
x_lmp[:] = x[0:three_n]
|
||||||
except: # lgtm [py/catch-base-exception]
|
except ValueError:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if v:
|
if v:
|
||||||
v_lmp = (c_double*(three_n))()
|
v_lmp = (c_double*(three_n))()
|
||||||
try:
|
try:
|
||||||
v_lmp[:] = v[0:three_n]
|
v_lmp[:] = v[0:three_n]
|
||||||
except: # lgtm [py/catch-base-exception]
|
except ValueError:
|
||||||
return 0
|
return 0
|
||||||
else:
|
else:
|
||||||
v_lmp = None
|
v_lmp = None
|
||||||
@ -1424,7 +1424,7 @@ class lammps(object):
|
|||||||
img_lmp = (self.c_imageint*n)()
|
img_lmp = (self.c_imageint*n)()
|
||||||
try:
|
try:
|
||||||
img_lmp[:] = image[0:n]
|
img_lmp[:] = image[0:n]
|
||||||
except: # lgtm [py/catch-base-exception]
|
except ValueError:
|
||||||
return 0
|
return 0
|
||||||
else:
|
else:
|
||||||
img_lmp = None
|
img_lmp = None
|
||||||
|
|||||||
Reference in New Issue
Block a user