From 40befc26f9d7fb817b04956978a2f34b1bd75996 Mon Sep 17 00:00:00 2001 From: Renaud Barate Date: Thu, 30 Oct 2014 14:13:29 +0000 Subject: [PATCH] Add exception InterruptParsingError to be able to interrupt file parsing (patch from M. Courtois) --- Noyau/N_Exception.py | 4 ++++ Noyau/N_JDC.py | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Noyau/N_Exception.py b/Noyau/N_Exception.py index 1c4b0221..bf4722e3 100644 --- a/Noyau/N_Exception.py +++ b/Noyau/N_Exception.py @@ -30,3 +30,7 @@ class AsException(Exception): def __str__(self): return unicode(self).encode(get_encoding()) + +class InterruptParsingError(Exception): + """Exception used to interrupt the parsing of the command file + without raising an error (see N_JDC.exec_compile for usage)""" diff --git a/Noyau/N_JDC.py b/Noyau/N_JDC.py index 463738ab..ba59be46 100644 --- a/Noyau/N_JDC.py +++ b/Noyau/N_JDC.py @@ -30,7 +30,7 @@ import types,sys,linecache # Modules EFICAS import N_OBJECT import N_CR -from N_Exception import AsException +from N_Exception import AsException, InterruptParsingError from N_ASSD import ASSD from N_info import message, SUPERV from strfunc import get_encoding @@ -213,6 +213,10 @@ Causes possibles : CONTEXT.unset_current_step() if self.appli != None : self.appli.affiche_infos('') + except InterruptParsingError: + # interrupt the command file parsing used by FIN to ignore the end of the file + pass + except EOFError: # Exception utilise pour interrompre un jeu # de commandes avant la fin -- 2.39.2