Skip to content

Commit

Permalink
Explicit file encoding for cuda mixed environment due to issue NVIDIA…
Browse files Browse the repository at this point in the history
  • Loading branch information
sunqm committed Nov 18, 2023
1 parent fbd9220 commit 574fa5a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pyscf/gto/mole.py
Expand Up @@ -2100,7 +2100,7 @@ def tofile(mol, filename, format=None):
if format is None: # Guess format based on filename
format = os.path.splitext(filename)[1][1:]
string = tostring(mol, format)
with open(filename, 'w') as f:
with open(filename, 'w', encoding='utf-8') as f:
f.write(string)
f.write('\n')
return string
Expand Down Expand Up @@ -2516,9 +2516,9 @@ def build(self, dump_input=True, parse_arg=ARGPARSE,
print('output file: %s' % self.output)

if self.output == '/dev/null':
self.stdout = open(os.devnull, 'w')
self.stdout = open(os.devnull, 'w', encoding='utf-8')
else:
self.stdout = open(self.output, 'w')
self.stdout = open(self.output, 'w', encoding='utf-8')

if self.verbose >= logger.WARN:
self.check_sanity()
Expand Down

0 comments on commit 574fa5a

Please sign in to comment.