jjorissen52 / python-qgenda

Simple Python API for QGenda
Apache License 2.0
3 stars 3 forks source link

config file error #4

Closed judywawira closed 4 years ago

judywawira commented 5 years ago

Hello

I copied the config file but keep getting this error _ have you seen this before?

Screen Shot 2019-11-20 at 11 01 34 AM

I have confirmed that all the fields are missing - and I can localize that the problem is at the level of JSON -but cannot figure out how to fix it

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

jjorissen52 commented 5 years ago

Usually issues with config will boil down to it looking in the wrong file. It's looking for a file in theQGENDA_CONF_FILE environment variable. From the README:

import os

# tell configparser where to look for config
os.environ['QGENDA_CONF_FILE'] = '/path/to/qgenda.conf'
# optional
os.environ['QGENDA_CONF_REGION'] = 'name_of_region' # defaults to qgenda

from qgenda.api import client
client = client.QGendaClient()
client.authenticate()

If you run the below and it cannot print out the contents of your config file, python probably cannot find your file path as indicated.

import os

os.environ['QGENDA_CONF_FILE'] = '/path/to/qgenda.conf'

with open(QGENDA_CONF_FILE, 'r') as config_file:
    print(config_file.read())

Having a look at how the config is loaded might help as well: https://github.com/jjorissen52/python-qgenda/blob/master/qgenda/settings.py

jjorissen52 commented 4 years ago

@judywawira Closing this. If you are still having issues I will reopen.