From 177d14c8eaf66aa5b712210975e6794b31c9558e Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Tue, 20 Nov 2018 14:27:44 +0100 Subject: [PATCH] px_romfs_pruner.py: remove deprecation warning The open flag `U` causes a deprecation warning starting with Python 3.4. The option to open all kinds of newlines as `\n` has been replaced with the argument `newline=None`. However, this argument is not available for Python 2 unless we use `io.open` instead of `open`. --- Tools/px_romfs_pruner.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tools/px_romfs_pruner.py b/Tools/px_romfs_pruner.py index 1b2518719f..7fc45fb212 100644 --- a/Tools/px_romfs_pruner.py +++ b/Tools/px_romfs_pruner.py @@ -49,6 +49,7 @@ from __future__ import print_function import argparse import re import os +import io def main(): @@ -88,7 +89,7 @@ def main(): # read file line by line pruned_content = "" board_excluded = False - with open(file_path, "rU") as f: + with io.open(file_path, "r", newline=None) as f: for line in f: if re.search(r'\b{0} exclude\b'.format(args.board),line): board_excluded = True;