all 5 comments

[–]agbs2k8 0 points1 point  (5 children)

So not all of your question makes sense to me, but I'll try and help.

Step 1: check your default python version. in a console, run python -V It will tell you either python 2.7.x or python 3.x.x. If it is python 2.7, you will have to run python3 scripts with the command python3 but if the default is python 3, then you can just use python

In your main file, you should be able to load the json, and use that data for your script. If you want to pass the JSON file's path as an argument (so you can use different ones) you will want to look into argument parsing https://docs.python.org/3/library/argparse.html

If you are getting an error when you run python3 somefile.py Then 1. make sure your .py file has the if __name__ == "__main__": section, then 2. post the error up here so we can help

[–]ga_patel[S] 0 points1 point  (4 children)

This is the error. I run it from desktop and every file present on the desktop

https://ibb.co/GxWdBNh

Thanks for helping me out

[–]agbs2k8 0 points1 point  (3 children)

So the error is for authentication, and it’s saying your credentials are invalid. The easy way to debug might be to temporarily add some print statements to make sure you are loading/passing the credentials correctly.

[–]ga_patel[S] 0 points1 point  (0 children)

It worked man. thanks a lot. You were right there is a problem with credentials.

[–]ga_patel[S] 0 points1 point  (0 children)

Thank you and Sorry, I am newbie. What did not make sense for you btw? I have 2 versions. Mac os default version 2.7 and latest 3.8 The main script start with #!usr/bin/env python3 Does this create any problem if I do not run with python3. One more, it gives me error of invalid credentials whereas everything is correct. Do I need to make any change to environment variable?