diff --git a/Framework/PythonInterface/plugins/algorithms/LoadCIF.py b/Framework/PythonInterface/plugins/algorithms/LoadCIF.py index 19384df7cb95e938bb78b843cddb26dad03dc67d..11a2ba02a28fbc5fda4d76b8b18948a8d94daf72 100644 --- a/Framework/PythonInterface/plugins/algorithms/LoadCIF.py +++ b/Framework/PythonInterface/plugins/algorithms/LoadCIF.py @@ -239,18 +239,28 @@ class LoadCIF(PythonAlgorithm): ' (https://pypi.python.org/pypi/PyCifRW/4.1)') def _loadFromCif(self): - cifFileName = self.getProperty('InputFile').value + from CifFile import ReadCif + + cifFileUrl = self._getFileUrl() workspace = self.getProperty('Workspace').value # Try to parse cif file using PyCifRW - from CifFile import ReadCif + parsedCifFile = ReadCif(cifFileUrl) - parsedCifFile = ReadCif(cifFileName) self._setCrystalStructureFromCifFile(workspace, parsedCifFile) + ubOption = self.getProperty('LoadUBMatrix').value if ubOption: self._setUBMatrixFromCifFile(workspace, parsedCifFile) + def _getFileUrl(self): + # ReadCif requires a URL, windows path specs seem to confuse urllib, + # so the pathname is converted to a URL before passing it to ReadCif. + from urllib import pathname2url + + cifFileName = self.getProperty('InputFile').value + return pathname2url(cifFileName) + def _setCrystalStructureFromCifFile(self, workspace, cifFile): crystalStructure = self._getCrystalStructureFromCifFile(cifFile) workspace.sample().setCrystalStructure(crystalStructure)