← Back to team overview

kicad-developers team mailing list archive

[PATCH] handle LoadBoard IOError exception in python scripts

 

Hi,

Loading a wrong file or an non-existing file with the LoadBoard python
function kill the program with the following message:

"""
terminate called after throwing an instance of 'IO_ERROR'
Abandon (core dumped)
"""

The attached patch enable exception handling for the LoadBoard function.

Damien Espitallier
From cc6ca8af7f681c043ae6e60f2ef27dabe131ce4c Mon Sep 17 00:00:00 2001
From: Damien Espitallier <damien.espitallier@xxxxxxxxx>
Date: Sat, 10 Feb 2018 13:46:54 +0100
Subject: [PATCH] Enable exception handler for python LoadBoard function
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------2.16.1"

This is a multi-part message in MIME format.
--------------2.16.1
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit

---
 pcbnew/swig/pcbnew.i | 1 +
 1 file changed, 1 insertion(+)


--------------2.16.1
Content-Type: text/x-patch; name="0001-Enable-exception-handler-for-python-LoadBoard-functi.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-Enable-exception-handler-for-python-LoadBoard-functi.patch"

diff --git a/pcbnew/swig/pcbnew.i b/pcbnew/swig/pcbnew.i
index 53c089168..f88b5b9bf 100644
--- a/pcbnew/swig/pcbnew.i
+++ b/pcbnew/swig/pcbnew.i
@@ -115,6 +115,7 @@ HANDLE_EXCEPTIONS(PLUGIN::FootprintDelete)
 %include <gal/color4d.h>
 %include <id.h>
 
+HANDLE_EXCEPTIONS(LoadBoard)
 %include <pcbnew_scripting_helpers.h>
 
 

--------------2.16.1--



Follow ups