Replace decode errors when reading device configs.

This commit is contained in:
grossmj committed 2014-05-29 12:59:13 -06:00
1 parent e817c13738
commit 61ef750da3
7 files changed
+11 -11

No files matched your search

+1 -1
View File
@@ -336,7 +336,7 @@ class VPCS(IModule):
if os.path.isfile(request["script_file"]) and request["script_file"] != config_path:
# this is a local file set in the GUI
try:
with open(request["script_file"], "r") as f:
with open(request["script_file"], "r", errors="replace") as f:
config = f.read()
with open(config_path, "w") as f:
config = config.replace("\r", "")
+2 -2
View File
@@ -170,7 +170,7 @@ class VPCSDevice(object):
config_path = os.path.join(self._working_dir, "startup.vpc")
if os.path.isfile(config_path):
try:
with open(config_path, "r+") as f:
with open(config_path, "r+", errors="replace") as f:
old_config = f.read()
new_config = old_config.replace(self._name, new_name)
f.seek(0)
@@ -388,7 +388,7 @@ class VPCSDevice(object):
output = ""
if self._vpcs_stdout_file:
try:
with open(self._vpcs_stdout_file) as file:
with open(self._vpcs_stdout_file, errors="replace") as file:
output = file.read()
except OSError as e:
log.warn("could not read {}: {}".format(self._vpcs_stdout_file, e))