MTAPI icon indicating copy to clipboard operation
MTAPI copied to clipboard

TypeError

Open realswamo opened this issue 5 years ago • 2 comments

Hello, when I run the script it is giving me a type error:

Traceback (most recent call last): File "app.py", line 62, in threaded=app.config['THREADED']) File "/home/pi/Desktop/MTAPI-master/mtapi/mtapi.py", line 84, in init self._stations = json.load(f) File "/usr/lib/python3.5/json/init.py", line 268, in load parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw) File "/usr/lib/python3.5/json/init.py", line 312, in loads s.class.name)) TypeError: the JSON object must be str, not 'bytes'

I deleted the folder and re-did all the installation. Thanks for creating this, it really comes in handy!

realswamo avatar Oct 23 '20 00:10 realswamo

This kinda looks like a problem with STATIONS_FILE in the config. What does your settings.cfg look like? (Don't share your MTA API key)

jonthornton avatar Nov 04 '20 02:11 jonthornton

Hey there, here is what my settings.cfg looks:

MTA_KEY = '***************'
STATIONS_FILE = './data/stations.json'
CROSS_ORIGIN = ''
MAX_TRAINS=10
MAX_MINUTES=30
CACHE_SECONDS=60
THREADED=True
DEBUG = True

realswamo avatar Nov 13 '20 02:11 realswamo

Should be fixed in https://github.com/jonthornton/MTAPI/commit/a0b421a929c6d232c711af3a6435de3df1dddf5f

jonthornton avatar Sep 26 '22 00:09 jonthornton