Skip to content

Commit

Permalink
fix path
Browse files Browse the repository at this point in the history
  • Loading branch information
bastinc committed Aug 22, 2018
1 parent bf6c971 commit 94c9a9d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ardas/sensor_tools.py
@@ -1,6 +1,5 @@
import numpy as np
import os
from pathlib import Path
from pickle import dump, load
import logging

Expand Down Expand Up @@ -50,7 +49,7 @@ def load_sensor(sensor_id):
:param sensor_id: a unique identification number of the sensor
:return: a sensor object
:rtype: sensor"""
f_name = cur_dir + '/sensor_' + sensor_id + '.ssr'
f_name = os.path.join(cur_dir,'sensor_' + sensor_id + '.ssr')
with open(f_name, 'rb') as sensor_file:
sensor = load(sensor_file)
return sensor
Expand Down Expand Up @@ -115,7 +114,7 @@ def output_repr(self, value):
def save(self):
"""Save the sensor as a serialized object to a file """
f_name = cur_dir + '/sensor_' + self.sensor_id + '.ssr'
if Path(f_name).exists():
if os.path.isfile(f_name):
logging.warning('Sensor file ' + f_name + ' already exists, unable to save sensor')
else:
with open(f_name, 'wb') as sensor_file:
Expand Down

0 comments on commit 94c9a9d

Please sign in to comment.