diff options
-rw-r--r-- | common/pybindings.cc | 8 | ||||
-rw-r--r-- | generic/examples/write_fasm.py | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/common/pybindings.cc b/common/pybindings.cc index f8f366cf..60f87e27 100644 --- a/common/pybindings.cc +++ b/common/pybindings.cc @@ -23,6 +23,7 @@ #include "pybindings.h" #include "arch_pybindings.h" #include "jsonparse.h" +#include "log.h" #include "nextpnr.h" #include <boost/filesystem.hpp> @@ -267,12 +268,15 @@ void execute_python_file(const char *python_file) fprintf(stderr, "Fatal error: file not found %s\n", python_file); exit(1); } - PyRun_SimpleFile(fp, python_file); + int result = PyRun_SimpleFile(fp, python_file); fclose(fp); + if (result == -1) { + log_error("Error occurred while executing Python script %s\n", python_file); + } } catch (boost::python::error_already_set const &) { // Parse and output the exception std::string perror_str = parse_python_exception(); - std::cout << "Error in Python: " << perror_str << std::endl; + log_error("Error in Python: %s\n", perror_str.c_str()); } } diff --git a/generic/examples/write_fasm.py b/generic/examples/write_fasm.py index fb55c41d..1f279b63 100644 --- a/generic/examples/write_fasm.py +++ b/generic/examples/write_fasm.py @@ -22,7 +22,7 @@ ParameterConfig.__new__.__defaults__ = (False, True, 1, None) Write a design as FASM ctx: nextpnr context - paramCfg: ParameterConfig describing how to write parameters + paramCfg: map from (celltype, parametername) -> ParameterConfig describing how to write parameters f: output file """ def write_fasm(ctx, paramCfg, f): |