diff --git a/doc/python_api/sphinx_changelog_gen.py b/doc/python_api/sphinx_changelog_gen.py index c96412b9d65..dc54de826ba 100644 --- a/doc/python_api/sphinx_changelog_gen.py +++ b/doc/python_api/sphinx_changelog_gen.py @@ -156,7 +156,8 @@ def api_dump(): for func_id, attr in funcs: # arg_str = inspect.formatargspec(*inspect.getargspec(py_func)) - func_args_ids = tuple(inspect.getargspec(attr).args) + sig = inspect.signature(attr) + func_args_ids = [k for k, v in sig.parameters.items()] dump_class[func_id] = ( "func_py", # basic_type @@ -175,7 +176,7 @@ def api_dump(): import pprint filename = api_dunp_fname() - filehandle = open(filename, 'w') + filehandle = open(filename, 'w', encoding='utf-8') tot = filehandle.write(pprint.pformat(dump, width=1)) filehandle.close() print("%s, %d bytes written" % (filename, tot)) @@ -199,11 +200,11 @@ def compare_props(a, b, fuzz=0.75): def api_changelog(api_from, api_to, api_out): - file_handle = open(api_from, 'r') + file_handle = open(api_from, 'r', encoding='utf-8') dict_from = eval(file_handle.read()) file_handle.close() - file_handle = open(api_to, 'r') + file_handle = open(api_to, 'r', encoding='utf-8') dict_to = eval(file_handle.read()) file_handle.close() @@ -266,7 +267,7 @@ def api_changelog(api_from, api_to, api_out): # also document function argument changes - fout = open(api_out, 'w') + fout = open(api_out, 'w', encoding='utf-8') fw = fout.write # print(api_changes)