From 5eb72fa2f340c49acb20acb22c9380c6d72ebd90 Mon Sep 17 00:00:00 2001 From: grossmj Date: Wed, 9 Apr 2014 16:13:45 -0600 Subject: [PATCH] Replace "windows-style" line endings (\r\n) by "UNIX-style" (\n) for the IOURC file. --- gns3server/modules/iou/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gns3server/modules/iou/__init__.py b/gns3server/modules/iou/__init__.py index 2ade866a..a6bfbdea 100644 --- a/gns3server/modules/iou/__init__.py +++ b/gns3server/modules/iou/__init__.py @@ -186,9 +186,9 @@ class IOU(IModule): iourc_content = base64.decodestring(request["iourc"].encode("utf-8")).decode("utf-8") iourc_content = iourc_content.replace("\r\n", "\n") # dos2unix try: - with tempfile.NamedTemporaryFile(delete=False) as f: + with tempfile.NamedTemporaryFile(mode="w", delete=False) as f: log.info("saving iourc file content to {}".format(f.name)) - f.write(iourc_content.encode('utf-8')) + f.write(iourc_content) self._iourc = f.name except OSError as e: raise IOUError("Could not save iourc file to {}: {}".format(f.name, e))