aboutsummaryrefslogtreecommitdiff
path: root/test.py
diff options
context:
space:
mode:
authorÉtienne Simon <esimon@esimon.eu>2015-05-18 18:57:08 -0400
committerÉtienne Simon <esimon@esimon.eu>2015-05-18 18:57:08 -0400
commit4f68132cc9c62860bd3368e559e430961c872636 (patch)
tree275554a1abcd419d0c477b639dcbd50189d3245d /test.py
parent6d946f29f7548c75e97f30c4356dbac200ee6cce (diff)
downloadtaxi-4f68132cc9c62860bd3368e559e430961c872636.tar.gz
taxi-4f68132cc9c62860bd3368e559e430961c872636.zip
Use os.path.join and close files
Diffstat (limited to 'test.py')
-rwxr-xr-xtest.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/test.py b/test.py
index bf39b15..545d6a0 100755
--- a/test.py
+++ b/test.py
@@ -28,11 +28,11 @@ if __name__ == "__main__":
model.set_param_values(parameters)
if 'destination' in outputs:
- dest_outfile = open("output/test-dest-output-%s.csv" % model_name, "w")
+ dest_outfile = open(os.path.join('output', 'test-dest-output-%s.csv' % model_name), 'w')
dest_outcsv = csv.writer(dest_outfile)
dest_outcsv.writerow(["TRIP_ID", "LATITUDE", "LONGITUDE"])
if 'duration' in outputs:
- time_outfile = open("output/test-time-output-%s.csv" % model_name, "w")
+ time_outfile = open(os.path.join('output', 'test-time-output-%s.csv' % model_name), 'w')
time_outcsv = csv.writer(time_outfile)
time_outcsv.writerow(["TRIP_ID", "TRAVEL_TIME"])
@@ -46,3 +46,8 @@ if __name__ == "__main__":
if 'duration' in outputs:
duration = output_values[outputs.index('duration')]
time_outcsv.writerow([d['trip_id'][0], duration[0]])
+
+ if 'destination' in outputs:
+ dest_outfile.close()
+ if 'duration' in outputs:
+ time_outfile.close()