We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bd4c27f commit bfd0b0fCopy full SHA for bfd0b0f
src/diffpy/structure/parsers/p_cif.py
@@ -23,6 +23,11 @@
23
from contextlib import contextmanager
24
import numpy
25
import six
26
+try:
27
+ import pathlib
28
+ has_pathlib = True
29
+except ImportError:
30
+ has_pathlib = False
31
32
from diffpy.structure import Structure, Lattice, Atom
33
from diffpy.structure import StructureFormatError
@@ -281,7 +286,11 @@ def parseFile(self, filename):
281
286
"""
282
287
self.ciffile = None
283
288
self.filename = filename
284
- rv = self._parseCifDataSource(filename)
289
+ if has_pathlib:
290
+ rv = self._parseCifDataSource(filename)
291
+ else:
292
+ fileurl = _quoteLocalPath(filename)
293
+ rv = self._parseCifDataSource(fileurl)
285
294
# all good here
295
return rv
296
0 commit comments