From 6819c109fe4ea76dbd60652a54bc66a56b59cf91 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Mart=C3=AD?= Date: Mon, 4 Jan 2016 17:01:37 +0100 Subject: [PATCH] Replace execfile with open+compile+exec --- fdroidserver/common.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 94c36b78..8f5350ff 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -20,6 +20,7 @@ # common.py is imported by all modules, so do not import third-party # libraries here as they will become a requirement for all commands. +import io import os import sys import re @@ -206,7 +207,9 @@ def read_config(opts, config_file='config.py'): config = {} logging.debug("Reading %s" % config_file) - execfile(config_file, config) + with io.open(config_file, "rb") as f: + code = compile(f.read(), config_file, 'exec') + exec(code, None, config) # smartcardoptions must be a list since its command line args for Popen if 'smartcardoptions' in config: -- 2.30.2