Color Oled(SSD1331) connect to STMicroelectronics Nucleo-F466

Dependencies:   ssd1331

Committer:
kadonotakashi
Date:
Thu Oct 11 02:27:46 2018 +0000
Revision:
3:f3764f852aa8
Parent:
0:8fdf9a60065b
Nucreo 446 + SSD1331 test version;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kadonotakashi 0:8fdf9a60065b 1 #! /usr/bin/env python2
kadonotakashi 0:8fdf9a60065b 2 """
kadonotakashi 0:8fdf9a60065b 3 mbed SDK
kadonotakashi 0:8fdf9a60065b 4 Copyright (c) 2011-2013 ARM Limited
kadonotakashi 0:8fdf9a60065b 5
kadonotakashi 0:8fdf9a60065b 6 Licensed under the Apache License, Version 2.0 (the "License");
kadonotakashi 0:8fdf9a60065b 7 you may not use this file except in compliance with the License.
kadonotakashi 0:8fdf9a60065b 8 You may obtain a copy of the License at
kadonotakashi 0:8fdf9a60065b 9
kadonotakashi 0:8fdf9a60065b 10 http://www.apache.org/licenses/LICENSE-2.0
kadonotakashi 0:8fdf9a60065b 11
kadonotakashi 0:8fdf9a60065b 12 Unless required by applicable law or agreed to in writing, software
kadonotakashi 0:8fdf9a60065b 13 distributed under the License is distributed on an "AS IS" BASIS,
kadonotakashi 0:8fdf9a60065b 14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
kadonotakashi 0:8fdf9a60065b 15 See the License for the specific language governing permissions and
kadonotakashi 0:8fdf9a60065b 16 limitations under the License.
kadonotakashi 0:8fdf9a60065b 17
kadonotakashi 0:8fdf9a60065b 18
kadonotakashi 0:8fdf9a60065b 19 TEST BUILD
kadonotakashi 0:8fdf9a60065b 20 """
kadonotakashi 0:8fdf9a60065b 21 from __future__ import print_function, division, absolute_import
kadonotakashi 0:8fdf9a60065b 22 import sys
kadonotakashi 0:8fdf9a60065b 23 import os
kadonotakashi 0:8fdf9a60065b 24 import fnmatch
kadonotakashi 0:8fdf9a60065b 25
kadonotakashi 0:8fdf9a60065b 26 ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
kadonotakashi 0:8fdf9a60065b 27 sys.path.insert(0, ROOT)
kadonotakashi 0:8fdf9a60065b 28
kadonotakashi 0:8fdf9a60065b 29 from tools.config import ConfigException, Config
kadonotakashi 0:8fdf9a60065b 30 from tools.test_configs import get_default_config
kadonotakashi 0:8fdf9a60065b 31 from tools.config import ConfigException
kadonotakashi 0:8fdf9a60065b 32 from tools.test_api import find_tests, get_test_config, print_tests, build_tests, test_spec_from_test_builds
kadonotakashi 0:8fdf9a60065b 33 import tools.test_configs as TestConfig
kadonotakashi 0:8fdf9a60065b 34 from tools.options import get_default_options_parser, extract_profile, extract_mcus
kadonotakashi 0:8fdf9a60065b 35 from tools.build_api import build_project, build_library
kadonotakashi 0:8fdf9a60065b 36 from tools.build_api import print_build_memory_usage
kadonotakashi 0:8fdf9a60065b 37 from tools.build_api import merge_build_data
kadonotakashi 0:8fdf9a60065b 38 from tools.targets import TARGET_MAP
kadonotakashi 0:8fdf9a60065b 39 from tools.notifier.term import TerminalNotifier
kadonotakashi 0:8fdf9a60065b 40 from tools.utils import mkdir, ToolException, NotSupportedException, args_error, write_json_to_file
kadonotakashi 0:8fdf9a60065b 41 from tools.test_exporters import ReportExporter, ResultExporterType
kadonotakashi 0:8fdf9a60065b 42 from tools.utils import argparse_filestring_type, argparse_lowercase_type, argparse_many
kadonotakashi 0:8fdf9a60065b 43 from tools.utils import argparse_dir_not_parent
kadonotakashi 0:8fdf9a60065b 44 from tools.toolchains import mbedToolchain, TOOLCHAIN_PATHS, TOOLCHAIN_CLASSES
kadonotakashi 0:8fdf9a60065b 45 from tools.settings import CLI_COLOR_MAP
kadonotakashi 0:8fdf9a60065b 46
kadonotakashi 0:8fdf9a60065b 47 if __name__ == '__main__':
kadonotakashi 0:8fdf9a60065b 48 try:
kadonotakashi 0:8fdf9a60065b 49 # Parse Options
kadonotakashi 0:8fdf9a60065b 50 parser = get_default_options_parser(add_app_config=True)
kadonotakashi 0:8fdf9a60065b 51
kadonotakashi 0:8fdf9a60065b 52 parser.add_argument("-D",
kadonotakashi 0:8fdf9a60065b 53 action="append",
kadonotakashi 0:8fdf9a60065b 54 dest="macros",
kadonotakashi 0:8fdf9a60065b 55 help="Add a macro definition")
kadonotakashi 0:8fdf9a60065b 56
kadonotakashi 0:8fdf9a60065b 57 parser.add_argument("-j", "--jobs",
kadonotakashi 0:8fdf9a60065b 58 type=int,
kadonotakashi 0:8fdf9a60065b 59 dest="jobs",
kadonotakashi 0:8fdf9a60065b 60 default=0,
kadonotakashi 0:8fdf9a60065b 61 help="Number of concurrent jobs. Default: 0/auto (based on host machine's number of CPUs)")
kadonotakashi 0:8fdf9a60065b 62
kadonotakashi 0:8fdf9a60065b 63 parser.add_argument("--source", dest="source_dir",
kadonotakashi 0:8fdf9a60065b 64 type=argparse_filestring_type,
kadonotakashi 0:8fdf9a60065b 65 default=None, help="The source (input) directory (for sources other than tests). Defaults to current directory.", action="append")
kadonotakashi 0:8fdf9a60065b 66
kadonotakashi 0:8fdf9a60065b 67 parser.add_argument("--build", dest="build_dir", type=argparse_dir_not_parent(ROOT),
kadonotakashi 0:8fdf9a60065b 68 default=None, help="The build (output) directory")
kadonotakashi 0:8fdf9a60065b 69
kadonotakashi 0:8fdf9a60065b 70 parser.add_argument("-l", "--list", action="store_true", dest="list",
kadonotakashi 0:8fdf9a60065b 71 default=False, help="List (recursively) available tests in order and exit")
kadonotakashi 0:8fdf9a60065b 72
kadonotakashi 0:8fdf9a60065b 73 parser.add_argument("-p", "--paths", dest="paths",
kadonotakashi 0:8fdf9a60065b 74 type=argparse_many(argparse_filestring_type),
kadonotakashi 0:8fdf9a60065b 75 default=None, help="Limit the tests to those within the specified comma separated list of paths")
kadonotakashi 0:8fdf9a60065b 76
kadonotakashi 0:8fdf9a60065b 77 format_choices = ["list", "json"]
kadonotakashi 0:8fdf9a60065b 78 format_default_choice = "list"
kadonotakashi 0:8fdf9a60065b 79 format_help = "Change the format in which tests are listed. Choices include: %s. Default: %s" % (", ".join(format_choices), format_default_choice)
kadonotakashi 0:8fdf9a60065b 80 parser.add_argument("-f", "--format", dest="format",
kadonotakashi 0:8fdf9a60065b 81 type=argparse_lowercase_type(format_choices, "format"),
kadonotakashi 0:8fdf9a60065b 82 default=format_default_choice, help=format_help)
kadonotakashi 0:8fdf9a60065b 83
kadonotakashi 0:8fdf9a60065b 84 parser.add_argument("--continue-on-build-fail", action="store_true", dest="continue_on_build_fail",
kadonotakashi 0:8fdf9a60065b 85 default=None, help="Continue trying to build all tests if a build failure occurs")
kadonotakashi 0:8fdf9a60065b 86
kadonotakashi 0:8fdf9a60065b 87 #TODO validate the names instead of just passing through str
kadonotakashi 0:8fdf9a60065b 88 parser.add_argument("-n", "--names", dest="names", type=argparse_many(str),
kadonotakashi 0:8fdf9a60065b 89 default=None, help="Limit the tests to a comma separated list of names")
kadonotakashi 0:8fdf9a60065b 90
kadonotakashi 0:8fdf9a60065b 91 parser.add_argument("--test-config", dest="test_config", type=str,
kadonotakashi 0:8fdf9a60065b 92 default=None, help="Test config for a module")
kadonotakashi 0:8fdf9a60065b 93
kadonotakashi 0:8fdf9a60065b 94 parser.add_argument("--test-spec", dest="test_spec",
kadonotakashi 0:8fdf9a60065b 95 default=None, help="Destination path for a test spec file that can be used by the Greentea automated test tool")
kadonotakashi 0:8fdf9a60065b 96
kadonotakashi 0:8fdf9a60065b 97 parser.add_argument("--build-report-junit", dest="build_report_junit",
kadonotakashi 0:8fdf9a60065b 98 default=None, help="Destination path for a build report in the JUnit xml format")
kadonotakashi 0:8fdf9a60065b 99 parser.add_argument("--build-data",
kadonotakashi 0:8fdf9a60065b 100 dest="build_data",
kadonotakashi 0:8fdf9a60065b 101 default=None,
kadonotakashi 0:8fdf9a60065b 102 help="Dump build_data to this file")
kadonotakashi 0:8fdf9a60065b 103
kadonotakashi 0:8fdf9a60065b 104 parser.add_argument("-v", "--verbose",
kadonotakashi 0:8fdf9a60065b 105 action="store_true",
kadonotakashi 0:8fdf9a60065b 106 dest="verbose",
kadonotakashi 0:8fdf9a60065b 107 default=False,
kadonotakashi 0:8fdf9a60065b 108 help="Verbose diagnostic output")
kadonotakashi 0:8fdf9a60065b 109
kadonotakashi 0:8fdf9a60065b 110 parser.add_argument("--stats-depth",
kadonotakashi 0:8fdf9a60065b 111 type=int,
kadonotakashi 0:8fdf9a60065b 112 dest="stats_depth",
kadonotakashi 0:8fdf9a60065b 113 default=2,
kadonotakashi 0:8fdf9a60065b 114 help="Depth level for static memory report")
kadonotakashi 0:8fdf9a60065b 115 parser.add_argument("--ignore", dest="ignore", type=argparse_many(str),
kadonotakashi 0:8fdf9a60065b 116 default=None, help="Comma separated list of patterns to add to mbedignore (eg. ./main.cpp)")
kadonotakashi 0:8fdf9a60065b 117 parser.add_argument("--icetea",
kadonotakashi 0:8fdf9a60065b 118 action="store_true",
kadonotakashi 0:8fdf9a60065b 119 dest="icetea",
kadonotakashi 0:8fdf9a60065b 120 default=False,
kadonotakashi 0:8fdf9a60065b 121 help="Only icetea tests")
kadonotakashi 0:8fdf9a60065b 122
kadonotakashi 0:8fdf9a60065b 123 parser.add_argument("--greentea",
kadonotakashi 0:8fdf9a60065b 124 action="store_true",
kadonotakashi 0:8fdf9a60065b 125 dest="greentea",
kadonotakashi 0:8fdf9a60065b 126 default=False,
kadonotakashi 0:8fdf9a60065b 127 help="Only greentea tests")
kadonotakashi 0:8fdf9a60065b 128
kadonotakashi 0:8fdf9a60065b 129 options = parser.parse_args()
kadonotakashi 0:8fdf9a60065b 130
kadonotakashi 0:8fdf9a60065b 131 # Filter tests by path if specified
kadonotakashi 0:8fdf9a60065b 132 if options.paths:
kadonotakashi 0:8fdf9a60065b 133 all_paths = options.paths
kadonotakashi 0:8fdf9a60065b 134 else:
kadonotakashi 0:8fdf9a60065b 135 all_paths = ["."]
kadonotakashi 0:8fdf9a60065b 136
kadonotakashi 0:8fdf9a60065b 137 all_tests = {}
kadonotakashi 0:8fdf9a60065b 138 tests = {}
kadonotakashi 0:8fdf9a60065b 139
kadonotakashi 0:8fdf9a60065b 140 # As default both test tools are enabled
kadonotakashi 0:8fdf9a60065b 141 if not (options.greentea or options.icetea):
kadonotakashi 0:8fdf9a60065b 142 options.greentea = True
kadonotakashi 0:8fdf9a60065b 143 options.icetea = True
kadonotakashi 0:8fdf9a60065b 144
kadonotakashi 0:8fdf9a60065b 145 # Target
kadonotakashi 0:8fdf9a60065b 146 if options.mcu is None:
kadonotakashi 0:8fdf9a60065b 147 args_error(parser, "argument -m/--mcu is required")
kadonotakashi 0:8fdf9a60065b 148 mcu = extract_mcus(parser, options)[0]
kadonotakashi 0:8fdf9a60065b 149
kadonotakashi 0:8fdf9a60065b 150 # Toolchain
kadonotakashi 0:8fdf9a60065b 151 if options.tool is None:
kadonotakashi 0:8fdf9a60065b 152 args_error(parser, "argument -t/--tool is required")
kadonotakashi 0:8fdf9a60065b 153 toolchain = options.tool[0]
kadonotakashi 0:8fdf9a60065b 154
kadonotakashi 0:8fdf9a60065b 155 if not TOOLCHAIN_CLASSES[toolchain].check_executable():
kadonotakashi 0:8fdf9a60065b 156 search_path = TOOLCHAIN_PATHS[toolchain] or "No path set"
kadonotakashi 0:8fdf9a60065b 157 args_error(parser, "Could not find executable for %s.\n"
kadonotakashi 0:8fdf9a60065b 158 "Currently set search path: %s"
kadonotakashi 0:8fdf9a60065b 159 % (toolchain, search_path))
kadonotakashi 0:8fdf9a60065b 160
kadonotakashi 0:8fdf9a60065b 161 # Assign config file. Precedence: test_config>app_config
kadonotakashi 0:8fdf9a60065b 162 # TODO: merge configs if both given
kadonotakashi 0:8fdf9a60065b 163 if options.test_config:
kadonotakashi 0:8fdf9a60065b 164 config = get_test_config(options.test_config, mcu)
kadonotakashi 0:8fdf9a60065b 165 if not config:
kadonotakashi 0:8fdf9a60065b 166 args_error(parser, "argument --test-config contains invalid path or identifier")
kadonotakashi 0:8fdf9a60065b 167 elif options.app_config:
kadonotakashi 0:8fdf9a60065b 168 config = options.app_config
kadonotakashi 0:8fdf9a60065b 169 else:
kadonotakashi 0:8fdf9a60065b 170 config = Config.find_app_config(options.source_dir)
kadonotakashi 0:8fdf9a60065b 171
kadonotakashi 0:8fdf9a60065b 172 if not config:
kadonotakashi 0:8fdf9a60065b 173 config = get_default_config(options.source_dir or ['.'], mcu)
kadonotakashi 0:8fdf9a60065b 174
kadonotakashi 0:8fdf9a60065b 175
kadonotakashi 0:8fdf9a60065b 176 # Find all tests in the relevant paths
kadonotakashi 0:8fdf9a60065b 177 for path in all_paths:
kadonotakashi 0:8fdf9a60065b 178 all_tests.update(find_tests(
kadonotakashi 0:8fdf9a60065b 179 base_dir=path,
kadonotakashi 0:8fdf9a60065b 180 target_name=mcu,
kadonotakashi 0:8fdf9a60065b 181 toolchain_name=toolchain,
kadonotakashi 0:8fdf9a60065b 182 icetea=options.icetea,
kadonotakashi 0:8fdf9a60065b 183 greentea=options.greentea,
kadonotakashi 0:8fdf9a60065b 184 app_config=config))
kadonotakashi 0:8fdf9a60065b 185
kadonotakashi 0:8fdf9a60065b 186 # Filter tests by name if specified
kadonotakashi 0:8fdf9a60065b 187 if options.names:
kadonotakashi 0:8fdf9a60065b 188 all_names = options.names
kadonotakashi 0:8fdf9a60065b 189 all_names = [x.lower() for x in all_names]
kadonotakashi 0:8fdf9a60065b 190
kadonotakashi 0:8fdf9a60065b 191 for name in all_names:
kadonotakashi 0:8fdf9a60065b 192 if any(fnmatch.fnmatch(testname, name) for testname in all_tests):
kadonotakashi 0:8fdf9a60065b 193 for testname, test in all_tests.items():
kadonotakashi 0:8fdf9a60065b 194 if fnmatch.fnmatch(testname, name):
kadonotakashi 0:8fdf9a60065b 195 tests[testname] = test
kadonotakashi 0:8fdf9a60065b 196 else:
kadonotakashi 0:8fdf9a60065b 197 print("[Warning] Test with name '%s' was not found in the "
kadonotakashi 0:8fdf9a60065b 198 "available tests" % (name))
kadonotakashi 0:8fdf9a60065b 199 else:
kadonotakashi 0:8fdf9a60065b 200 tests = all_tests
kadonotakashi 0:8fdf9a60065b 201
kadonotakashi 0:8fdf9a60065b 202
kadonotakashi 0:8fdf9a60065b 203 if options.list:
kadonotakashi 0:8fdf9a60065b 204 # Print available tests in order and exit
kadonotakashi 0:8fdf9a60065b 205 print_tests(tests, options.format)
kadonotakashi 0:8fdf9a60065b 206 sys.exit(0)
kadonotakashi 0:8fdf9a60065b 207 else:
kadonotakashi 0:8fdf9a60065b 208 # Build all tests
kadonotakashi 0:8fdf9a60065b 209 if not options.build_dir:
kadonotakashi 0:8fdf9a60065b 210 args_error(parser, "argument --build is required")
kadonotakashi 0:8fdf9a60065b 211
kadonotakashi 0:8fdf9a60065b 212 base_source_paths = options.source_dir
kadonotakashi 0:8fdf9a60065b 213
kadonotakashi 0:8fdf9a60065b 214 # Default base source path is the current directory
kadonotakashi 0:8fdf9a60065b 215 if not base_source_paths:
kadonotakashi 0:8fdf9a60065b 216 base_source_paths = ['.']
kadonotakashi 0:8fdf9a60065b 217
kadonotakashi 0:8fdf9a60065b 218 build_report = {}
kadonotakashi 0:8fdf9a60065b 219 build_properties = {}
kadonotakashi 0:8fdf9a60065b 220
kadonotakashi 0:8fdf9a60065b 221 library_build_success = False
kadonotakashi 0:8fdf9a60065b 222 profile = extract_profile(parser, options, toolchain)
kadonotakashi 0:8fdf9a60065b 223 try:
kadonotakashi 0:8fdf9a60065b 224 # Build sources
kadonotakashi 0:8fdf9a60065b 225 notify = TerminalNotifier(options.verbose)
kadonotakashi 0:8fdf9a60065b 226 build_library(base_source_paths, options.build_dir, mcu,
kadonotakashi 0:8fdf9a60065b 227 toolchain, jobs=options.jobs,
kadonotakashi 0:8fdf9a60065b 228 clean=options.clean, report=build_report,
kadonotakashi 0:8fdf9a60065b 229 properties=build_properties, name="mbed-build",
kadonotakashi 0:8fdf9a60065b 230 macros=options.macros,
kadonotakashi 0:8fdf9a60065b 231 notify=notify, archive=False,
kadonotakashi 0:8fdf9a60065b 232 app_config=config,
kadonotakashi 0:8fdf9a60065b 233 build_profile=profile,
kadonotakashi 0:8fdf9a60065b 234 ignore=options.ignore)
kadonotakashi 0:8fdf9a60065b 235
kadonotakashi 0:8fdf9a60065b 236 library_build_success = True
kadonotakashi 0:8fdf9a60065b 237 except ToolException as e:
kadonotakashi 0:8fdf9a60065b 238 # ToolException output is handled by the build log
kadonotakashi 0:8fdf9a60065b 239 pass
kadonotakashi 0:8fdf9a60065b 240 except NotSupportedException as e:
kadonotakashi 0:8fdf9a60065b 241 # NotSupportedException is handled by the build log
kadonotakashi 0:8fdf9a60065b 242 pass
kadonotakashi 0:8fdf9a60065b 243 except Exception as e:
kadonotakashi 0:8fdf9a60065b 244 if options.verbose:
kadonotakashi 0:8fdf9a60065b 245 import traceback
kadonotakashi 0:8fdf9a60065b 246 traceback.print_exc()
kadonotakashi 0:8fdf9a60065b 247 # Some other exception occurred, print the error message
kadonotakashi 0:8fdf9a60065b 248 print(e)
kadonotakashi 0:8fdf9a60065b 249
kadonotakashi 0:8fdf9a60065b 250 if not library_build_success:
kadonotakashi 0:8fdf9a60065b 251 print("Failed to build library")
kadonotakashi 0:8fdf9a60065b 252 else:
kadonotakashi 0:8fdf9a60065b 253 # Build all the tests
kadonotakashi 0:8fdf9a60065b 254 notify = TerminalNotifier(options.verbose)
kadonotakashi 0:8fdf9a60065b 255 test_build_success, test_build = build_tests(
kadonotakashi 0:8fdf9a60065b 256 tests,
kadonotakashi 0:8fdf9a60065b 257 [os.path.relpath(options.build_dir)],
kadonotakashi 0:8fdf9a60065b 258 options.build_dir,
kadonotakashi 0:8fdf9a60065b 259 mcu,
kadonotakashi 0:8fdf9a60065b 260 toolchain,
kadonotakashi 0:8fdf9a60065b 261 clean=options.clean,
kadonotakashi 0:8fdf9a60065b 262 report=build_report,
kadonotakashi 0:8fdf9a60065b 263 properties=build_properties,
kadonotakashi 0:8fdf9a60065b 264 macros=options.macros,
kadonotakashi 0:8fdf9a60065b 265 notify=notify,
kadonotakashi 0:8fdf9a60065b 266 jobs=options.jobs,
kadonotakashi 0:8fdf9a60065b 267 continue_on_build_fail=options.continue_on_build_fail,
kadonotakashi 0:8fdf9a60065b 268 app_config=config,
kadonotakashi 0:8fdf9a60065b 269 build_profile=profile,
kadonotakashi 0:8fdf9a60065b 270 stats_depth=options.stats_depth,
kadonotakashi 0:8fdf9a60065b 271 ignore=options.ignore)
kadonotakashi 0:8fdf9a60065b 272
kadonotakashi 0:8fdf9a60065b 273 # If a path to a test spec is provided, write it to a file
kadonotakashi 0:8fdf9a60065b 274 if options.test_spec:
kadonotakashi 0:8fdf9a60065b 275 write_json_to_file(test_spec_from_test_builds(test_build), options.test_spec)
kadonotakashi 0:8fdf9a60065b 276
kadonotakashi 0:8fdf9a60065b 277 # If a path to a JUnit build report spec is provided, write it to a file
kadonotakashi 0:8fdf9a60065b 278 if options.build_report_junit:
kadonotakashi 0:8fdf9a60065b 279 report_exporter = ReportExporter(ResultExporterType.JUNIT, package="build")
kadonotakashi 0:8fdf9a60065b 280 report_exporter.report_to_file(build_report, options.build_report_junit, test_suite_properties=build_properties)
kadonotakashi 0:8fdf9a60065b 281
kadonotakashi 0:8fdf9a60065b 282 # Print memory map summary on screen
kadonotakashi 0:8fdf9a60065b 283 if build_report:
kadonotakashi 0:8fdf9a60065b 284 print
kadonotakashi 0:8fdf9a60065b 285 print(print_build_memory_usage(build_report))
kadonotakashi 0:8fdf9a60065b 286
kadonotakashi 0:8fdf9a60065b 287 print_report_exporter = ReportExporter(ResultExporterType.PRINT, package="build")
kadonotakashi 0:8fdf9a60065b 288 status = print_report_exporter.report(build_report)
kadonotakashi 0:8fdf9a60065b 289 if options.build_data:
kadonotakashi 0:8fdf9a60065b 290 merge_build_data(options.build_data, build_report, "test")
kadonotakashi 0:8fdf9a60065b 291
kadonotakashi 0:8fdf9a60065b 292 if status:
kadonotakashi 0:8fdf9a60065b 293 sys.exit(0)
kadonotakashi 0:8fdf9a60065b 294 else:
kadonotakashi 0:8fdf9a60065b 295 sys.exit(1)
kadonotakashi 0:8fdf9a60065b 296
kadonotakashi 0:8fdf9a60065b 297 except KeyboardInterrupt as e:
kadonotakashi 0:8fdf9a60065b 298 print("\n[CTRL+c] exit")
kadonotakashi 0:8fdf9a60065b 299 except ConfigException as e:
kadonotakashi 0:8fdf9a60065b 300 # Catching ConfigException here to prevent a traceback
kadonotakashi 0:8fdf9a60065b 301 print("[ERROR] %s" % str(e))
kadonotakashi 0:8fdf9a60065b 302 except Exception as e:
kadonotakashi 0:8fdf9a60065b 303 import traceback
kadonotakashi 0:8fdf9a60065b 304 traceback.print_exc(file=sys.stdout)
kadonotakashi 0:8fdf9a60065b 305 print("[ERROR] %s" % str(e))
kadonotakashi 0:8fdf9a60065b 306 sys.exit(1)
kadonotakashi 0:8fdf9a60065b 307