diff --git a/README.md b/README.md index 1006c1b..a1eb00d 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,13 @@ astyle --style=ansi your.cpp source.cpp files.cpp cpp2python.py -v|--version|-h|--help Display the help message After the processing new file is created. -File name is {old file name with suffix}.py. i.e. main.cpp.py +File name is `{old file name with suffix}.py`. i.e. `main.cpp.py` + +### Installation +(Optional, the script can be used from the source tree) + + python3 setup.py install + ### Author Andrei Kopats diff --git a/cpp2python.py b/cpp2python.py index 5888b27..c98e98c 100755 --- a/cpp2python.py +++ b/cpp2python.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 help = """The script helps to convert C/C++ sources to C/C++ -like Python sources. @@ -285,9 +285,9 @@ def process_file(in_filename, out_filename): """ generator - outputs processed file """ - with open(in_filename, 'r') as file: + with open(in_filename, 'r', encoding='utf-8') as file: lines = file.readlines() # probably would die on sources more than 100 000 lines :D - with open(out_filename, 'w+') as file: + with open(out_filename, 'w+', encoding='utf-8') as file: for line in lines: file.write(process_line(line))