We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c92fdd8 commit f2b65adCopy full SHA for f2b65ad
src/diffpy/srmise/pdfdataset.py
@@ -202,7 +202,10 @@ def read(self, filename):
202
self
203
"""
204
try:
205
- self.readStr(open(filename, "rb").read())
+ # Open the file in binary mode, read it, and decode to convert bytes to string
206
+ with open(filename, "rb") as file:
207
+ file_content = file.read().decode('utf-8')
208
+ self.readStr(file_content)
209
except PDFDataFormatError as err:
210
basename = os.path.basename(filename)
211
emsg = ("Could not open '%s' due to unsupported file format " + "or corrupted data. [%s]") % (
0 commit comments