Martyn Houghton Posted September 1, 2017 Posted September 1, 2017 Hopefully this is very simple question(s) for those of you experienced with Python, but this is a new avenue for me! At the moment I am just trying to get the Example (example.py) to run, but at the moment I just get syntax error when attempting to run it in Python 3.6.2. https://github.com/hornbill/pythonApiLib I think I have updated the correct lines to include our instance and API Key, but one question on the former is this just the instance name or the full URL? Also do I need to put the exception.py and xmlmc.py in a specific location in the Python folder so they are picked up. Cheers Martyn
TrevorKillick Posted September 1, 2017 Posted September 1, 2017 @Martyn Houghton Can you post the exact message you are getting?Edit: I have tried this my self on Python 2.7.13 i had to install lxml (pip get lxml) i have updated the read me to show this. Kind Regards Trevor Killick
Martyn Houghton Posted September 1, 2017 Author Posted September 1, 2017 @TrevorKillick Not sure if it is down to version or the fact that I am using Python for Windows, put pip get lxml does not work, I had to use the pip install lxml format. I give it another try. Cheers Martyn 1
TrevorKillick Posted September 1, 2017 Posted September 1, 2017 Sorry i copied the wrong command from my history as you correctly found its install not get i will update the readme. Thanks Trev
Martyn Houghton Posted September 1, 2017 Author Posted September 1, 2017 @TrevorKillick Ok getting a bit further, but the xmlxc seems to be trying to load request.py and will also want warnings.py, but they are not include on the GitHub folder, unless these are generic modules? from lxml import etree import base64 import requests import exception import warnings So get the error below:- Cheers Martyn
TrevorKillick Posted September 1, 2017 Posted September 1, 2017 @Martyn Houghton For my install of python requests is part of site-packages so i must have installed it at some point as with lxml if you do pip install for any missing package and let me know if anything other than requests needs to be installed and i will update the documentation. Sorry about the inconvenience. Kind Regards Trevor Killick
Martyn Houghton Posted September 1, 2017 Author Posted September 1, 2017 @TrevorKillick After doing 'pip install requests' from the python scripts folder, the example.py will run and complete. To confirm I just added the following print lines to the if statement to prove it had connected, else all you get in the fact that it completes without an error. if XmlmcHelper.is_call_success(json_string): user_id = XmlmcHelper.get_param_value(json_string, "params/userId") time_zone = XmlmcHelper.get_param_value(json_string, "params/regionalSettings/timeZone") print(user_id) print(time_zone) else: print(XmlmcHelper.get_error_message(json_string)) Cheers Martyn 1
TrevorKillick Posted September 1, 2017 Posted September 1, 2017 Thanks Martyn Yeah i did the same so i will update the example code and docs. Thanks Trevor
Martyn Houghton Posted March 26, 2019 Author Posted March 26, 2019 @TrevorKillick Having had to reinstall my machine and Python a fresh, I tripped over the same issue again, but luckily I have a vague memory of posting this on forum . If you could update the documentation to include the 'pip install requests' prerequisite when you have a moment. Cheers Martyn
TrevorKillick Posted March 26, 2019 Posted March 26, 2019 @Martyn Houghton Updated the dependancys docs Cheers Trev
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now