diff --git a/news/catch-YapsSyntaxError.rst b/news/catch-YapsSyntaxError.rst new file mode 100644 index 00000000..7e35ae76 --- /dev/null +++ b/news/catch-YapsSyntaxError.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* Let ``diffpy.structure`` pass the tests with ``pycifrw`` installed from ``PyPI``. + +**Security:** + +* diff --git a/src/diffpy/structure/parsers/p_cif.py b/src/diffpy/structure/parsers/p_cif.py index cb2f3fa1..3d0611ab 100644 --- a/src/diffpy/structure/parsers/p_cif.py +++ b/src/diffpy/structure/parsers/p_cif.py @@ -32,6 +32,7 @@ from contextlib import contextmanager import numpy +from CifFile.yapps3_compiled_rt import YappsSyntaxError from diffpy.structure import Atom, Lattice, Structure from diffpy.structure.parsers import StructureParser @@ -408,7 +409,7 @@ def _parseCifDataSource(self, datasource): # stop after reading the first structure if self.stru is not None: break - except (StarError, ValueError, IndexError) as err: + except (YappsSyntaxError, StarError, ValueError, IndexError) as err: exc_type, exc_value, exc_traceback = sys.exc_info() emsg = str(err).strip() e = StructureFormatError(emsg)