Skip to content

Commit 80cda5e

Browse files
committed
Allowed for latin1 encoding for fortran files as a backup if default in python fails
1 parent f786a49 commit 80cda5e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

scripts/compile_abaqus.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ def build_model(model_cat, model_info):
5959
file_contents = ''
6060
for model_file in model_files:
6161
file = pl.Path('../models/' + model_cat) / 'src' / model_file.strip('"')
62-
file_contents = file_contents + file.read_text() + '\n'
62+
try:
63+
file_contents = file_contents + file.read_text() + '\n'
64+
except UnicodeDecodeError:
65+
file_contents = file_contents + file.read_text(encoding='latin1') + '\n'
6366

6467
# dec_freeform (if written, is not needed within the file). Remove it, and add it in the beginning of the whole file
6568
dec_freeform = '!DEC$ FREEFORM'

0 commit comments

Comments
 (0)