ut-astria / orbdetpy

Orbit Determination with Python
https://ut-astria.github.io/orbdetpy
GNU General Public License v3.0
115 stars 38 forks source link

JSON Decode Error being raised testing orbdetpy #13

Closed OrbitalMechanic closed 4 years ago

OrbitalMechanic commented 4 years ago

I have orbdetpy installed on a Mac Pro (2019) running Mac OS X ver. 10.15.3 (Catalina) under the Anaconda distribution (Python 3.7.6). In running the example posted on https://github.com/ut-astria/orbdetpy, and as listed below.

(base) user@Samuels-Mac-Pro examples % python run_tests.py run_tests start : 2020-03-05 00:21:11 Simulating azel_sim_cfg.json Simulating radec_sim_cfg.json Simulating tle_sim_cfg.json Simulating radar_sim_cfg.json Simulating radec_sim_cfg.json Simulating plate_sim_cfg.json Fitting radec_od_cfg.json Fitting radar_od_cfg.json Fitting tle_od_cfg.json Fitting azel_od_cfg.json Fitting radec_od_cfg.json Fitting plate_od_cfg.json Fitting posvel_od_cfg.json run_tests end : 2020-03-05 00:21:59

(base) user@Samuels-Mac-Pro examples % python Python 3.7.6 (default, Jan 8 2020, 13:42:34) [Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin Type "help", "copyright", "credits" or "license" for more information.

from orbdetpy.simulation import simulate_measurements simulate_measurements("radar_sim_cfg.json", output_file = "sim_data.json") Traceback (most recent call last): File "", line 1, in File "/Users/user/opt/anaconda3/lib/python3.7/site-packages/orbdetpy/simulation.py", line 62, in simulate_measurements resp = stub.simulateMeasurements.future(build_settings(config)) File "/Users/user/opt/anaconda3/lib/python3.7/site-packages/orbdetpy/rpc/tools.py", line 102, in build_settings inp = read_param(param) File "/Users/user/opt/anaconda3/lib/python3.7/site-packages/orbdetpy/init.py", line 29, in read_param data = json.loads(param) File "/Users/user/opt/anaconda3/lib/python3.7/json/init.py", line 348, in loads return _default_decoder.decode(s) File "/Users/user/opt/anaconda3/lib/python3.7/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/Users/user/opt/anaconda3/lib/python3.7/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

A JSON decode error occurred when I executed the command simulate_measurements("radar_sim_cfg.json", output_file = "sim_data.json").

Any thoughts on how to fix this problem?

Sam Dupree.

Shiva-Iyer commented 4 years ago

You need to either cd into the folder that contains radar_sim_cfg.json or pass the fully qualified path name to radar_sim_cfg.json as the first argument to simulate_measurements. Otherwise it will look for that file in your current working directory which is probably not where the json file is.