From 4cde057ea2c2d0cb8736aaa1fe6600f5fa41c8fa Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 17 Mar 2020 11:32:10 +0100 Subject: [PATCH] Fixed UnicodeError --- src/init.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/init.py b/src/init.py index 10b32f0..4d19e32 100644 --- a/src/init.py +++ b/src/init.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # IRPF90 is a Fortran90 preprocessor written in Python for programming using # the Implicit Reference to Parameters (IRP) method. -# Copyright (C) 2009 Anthony SCEMAMA +# Copyright (C) 2009 Anthony SCEMAMA # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,8 +20,8 @@ # Anthony Scemama # LCPQ - IRSAMC - CNRS # Universite Paul Sabatier -# 118, route de Narbonne -# 31062 Toulouse Cedex 4 +# 118, route de Narbonne +# 31062 Toulouse Cedex 4 # scemama@irsamc.ups-tlse.fr @@ -61,7 +61,7 @@ def init(): # Create makefile makefile.create() - + # Copy current files in the irpdir for dir in ['./']+command_line.include_dir: try: @@ -78,12 +78,15 @@ def init(): if command_line.do_warnings: print("Warning : Unable to read file %s."%(filename)) else: - buffer = file.read() - file.close() - if not util.same_file(irpf90_t.irpdir+filename,buffer): - file = open(irpf90_t.irpdir+filename,"w") - file.write(buffer) + try: + buffer = file.read() file.close() + if not util.same_file(irpf90_t.irpdir+filename,buffer): + file = open(irpf90_t.irpdir+filename,"w") + file.write(buffer) + file.close() + except UnicodeError: + pass initialized = True