From 990f243f151da8d673ae05c081b61633c3b7b984 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Wed, 1 Apr 2015 19:55:11 +0200 Subject: [PATCH] Do not crash if dynamips config contain non ascii chars But I don't know why user can want to do that. Fix #123 --- gns3server/modules/dynamips/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gns3server/modules/dynamips/__init__.py b/gns3server/modules/dynamips/__init__.py index b8053c3e..1592e9ce 100644 --- a/gns3server/modules/dynamips/__init__.py +++ b/gns3server/modules/dynamips/__init__.py @@ -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))