diff --git a/bindings/python/example_scripts/gncinvoice_jinja.py b/bindings/python/example_scripts/gncinvoice_jinja.py index 73aa805b82..c6d59c4dfa 100644 --- a/bindings/python/example_scripts/gncinvoice_jinja.py +++ b/bindings/python/example_scripts/gncinvoice_jinja.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- ##@file @@ -63,7 +63,7 @@ def main(argv=None): try: opts, args = getopt.getopt(argv[1:], "fhlI:t:o:", ["help"]) - except getopt.error, msg: + except getopt.error as msg: raise Usage(msg) for opt in opts: @@ -105,12 +105,12 @@ def main(argv=None): filename_output = filename_template + ".out" print("no output filename given, will be:", filename_output) - except Usage, err: + except Usage as err: if err.msg == "Help:": retcode=0 else: - print(>>sys.stderr, "Error:",err.msg) - print(>>sys.stderr, "for help use --help") + print("Error:", err.msg, file=sys.stderr) + print("for help use --help", file=sys.stderr) retcode=2 print() diff --git a/bindings/python/example_scripts/str_methods.py b/bindings/python/example_scripts/str_methods.py index d1f2f52b8d..64c81445ce 100644 --- a/bindings/python/example_scripts/str_methods.py +++ b/bindings/python/example_scripts/str_methods.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ## @file # @brief Add __str__ and __unicode__ methods to financial objects so that @code print object @endcode leads to human readable results """ @package str_methods.py -- Add __str__ and __unicode__ methods to financial objects @@ -30,7 +30,8 @@ # * It seems useful to have an object for each modification. That is because there is some Initialisation to be done. # -import gnucash, function_class +import gnucash +from gnucash import function_class # Default values for encoding of strings in GnuCashs Database DEFAULT_ENCODING = "UTF-8"