Made read_config robuster against CWD

This commit is contained in:
2018-06-10 13:07:28 +02:00
parent 86b75c0504
commit caf88ab7e7
2 changed files with 10 additions and 3 deletions

View File

@@ -2,7 +2,10 @@ from __future__ import division
import numpy as np
import cv2
from naoqi import ALProxy
try:
from naoqi import ALProxy
except:
ALProxy = None
class NaoImageReader(object):

View File

@@ -1,7 +1,11 @@
import os
import json
def read_config():
with open('nao_defaults.json') as f:
HERE = os.path.dirname(os.path.realpath(__file__))
def read_config(cfg_file=os.path.join(HERE, 'nao_defaults.json')):
with open(cfg_file) as f:
cfg = json.load(f)
return cfg