Do not crash if dynamips config contain non ascii chars

But I don't know why user can want to do that.

Fix #123
This commit is contained in:
Julien Duponchelle 2015-04-01 19:55:11 +02:00
parent 49f36a83bd
commit 990f243f15

View File

@ -560,8 +560,8 @@ class Dynamips(BaseManager):
raise DynamipsError("Could not create Dynamips configs directory: {}".format(e))
try:
with open(path, "w") as f:
f.write(content)
with open(path, "wb") as f:
f.write(content.encode("utf-8"))
except OSError as e:
raise DynamipsError("Could not create config file {}: {}".format(path, e))