diff --git a/IPython/config/application.py b/IPython/config/application.py index af44f8c..7376cd8 100644 --- a/IPython/config/application.py +++ b/IPython/config/application.py @@ -88,9 +88,7 @@ def catch_config_error(method, app, *args, **kwargs): try: return method(app, *args, **kwargs) except (TraitError, ArgumentError) as e: - app.print_description() app.print_help() - app.print_examples() app.log.fatal("Bad config encountered during initialization:") app.log.fatal(str(e)) app.log.debug("Config at the time: %s", app.config) @@ -337,6 +335,7 @@ class Application(SingletonConfigurable): If classes=False (the default), only flags and aliases are printed. """ + self.print_description() self.print_subcommands() self.print_options() @@ -356,6 +355,9 @@ class Application(SingletonConfigurable): print "To see all available configurables, use `--help-all`" print + self.print_examples() + + def print_description(self): """Print the application description.""" for p in wrap_paragraphs(self.description): @@ -475,9 +477,7 @@ class Application(SingletonConfigurable): interpreted_argv = argv if any(x in interpreted_argv for x in ('-h', '--help-all', '--help')): - self.print_description() self.print_help('--help-all' in interpreted_argv) - self.print_examples() self.exit(0) if '--version' in interpreted_argv or '-V' in interpreted_argv: diff --git a/IPython/nbconvert/nbconvertapp.py b/IPython/nbconvert/nbconvertapp.py index 5087213..99f1427 100755 --- a/IPython/nbconvert/nbconvertapp.py +++ b/IPython/nbconvert/nbconvertapp.py @@ -209,24 +209,14 @@ class NbConvertApp(BaseIPythonApplication): "\n\t" + "\n\t".join(get_export_names()), file=sys.stderr) sys.exit(-1) - # except Exception as e: - # print("Error: could not export '%s'" % notebook_filename, file=sys.stderr) - # print(e, file=sys.stderr) else: self.writer.write(output, resources, notebook_name=notebook_name) conversion_success += 1 # If nothing was converted successfully, help the user. if conversion_success == 0: - - # No notebooks were specified, show help. - if len(self.notebooks) == 0: - self.print_help() - - # Notebooks were specified, but not converted successfully. Show how - # to access help. - else: - print('For help, use "ipython nbconvert --help"') + self.print_help() + sys.exit(-1) #-----------------------------------------------------------------------------