From 854b7394311172afbb67405d50abeb703aaea234 Mon Sep 17 00:00:00 2001 From: Lucretiel Date: Thu, 8 Aug 2013 03:52:47 -0400 Subject: [PATCH] The createDefaultKnownNodes function now uses a with statement --- src/defaultKnownNodes.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/defaultKnownNodes.py b/src/defaultKnownNodes.py index 52e31fff..d4611099 100644 --- a/src/defaultKnownNodes.py +++ b/src/defaultKnownNodes.py @@ -37,12 +37,10 @@ def createDefaultKnownNodes(appdata): #print stream1 #print allKnownNodes - output = open(appdata + 'knownnodes.dat', 'wb') + with open(appdata + 'knownnodes.dat', 'wb) as output: + # Pickle dictionary using protocol 0. + pickle.dump(allKnownNodes, output) - # Pickle dictionary using protocol 0. - pickle.dump(allKnownNodes, output) - - output.close() return allKnownNodes def readDefaultKnownNodes(appdata): -- 2.45.1