diff --git a/python/taichi/lang/field.py b/python/taichi/lang/field.py index 29a2d11de19c3..c5827c477eff9 100644 --- a/python/taichi/lang/field.py +++ b/python/taichi/lang/field.py @@ -187,6 +187,8 @@ def __getitem__(self, key): def __str__(self): if impl.inside_kernel(): return self.__repr__() # make pybind11 happy, see Matrix.__str__ + if self.snode.ptr is None: + return '' else: return str(self.to_numpy())