Commit 4a8219b4 authored by Michael Murtaugh's avatar Michael Murtaugh
Browse files

updated settext to py3

parent 59de1fa7
from __future__ import print_function
from argparse import ArgumentParser
import json, sys
from urllib import urlencode
from urllib2 import urlopen, HTTPError, URLError
try:
# python2
from urllib2 import urlopen, URLError, HTTPError
from urllib import urlencode
except ImportError:
# python3
from urllib.parse import urlencode, quote
from urllib.request import urlopen, URLError, HTTPError
import requests
......@@ -56,5 +64,5 @@ def main(args):
results = requests.post(requesturl, params=data) # json.load(urlopen(requesturl))
results = json.loads(results.text)
if results['code'] != 0:
print (u"setText: ERROR ({0}) on pad {1}: {2}".format(results['code'], args.padid, results['message']).encode("utf-8"))
print ("setText: ERROR ({0}) on pad {1}: {2}".format(results['code'], args.padid, results['message']))
# json.dumps(results, indent=2)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment