May-19-2019, 01:45 PM
I'm trying to debug the ubuntu-mate-welcome python script which is refusing to load a valid json file.
I have validated the json file with jsonlint. However my experience with python is limited.
My environment is Ubuntu 18.04 aarch64 (arm64).
I have isolated the problem code in an example included here:
Output from jsonlint-php:
How can I be certain I have the json module installed?
I have validated the json file with jsonlint. However my experience with python is limited.
My environment is Ubuntu 18.04 aarch64 (arm64).
I have isolated the problem code in an example included here:
#! /usr/bin/python3
import sys
import json
print(sys.path)
json_path = ''
try:
print('Reading index...')
json_path = '/usr/share/ubuntu-mate-welcome/js/applications.json'
with open(json_path) as data_file:
print('Loading JSON.')
index = json.load(data_file)
print('LOADED JSON!!!!')
except Exception as e:
index = None
print('Software Index JSON is invalid or missing!')
print(json_path)The output is as follows:Output:['/home/odroid/Scripts', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages']
Reading index...
Loading JSON.
Software Index JSON is invalid or missing!
/usr/share/ubuntu-mate-welcome/js/applications.jsonHowever my example does not display the :Error:IndexError: list index out of rangeSo I am not certain I have faithfully reproduced the problem!Output from jsonlint-php:
Output:jsonlint-php /usr/share/ubuntu-mate-welcome/js/applications.json
Valid JSON (/usr/share/ubuntu-mate-welcome/js/applications.json)I have looked in the python path but cannot identify the json module referred to in the import statement.How can I be certain I have the json module installed?
