requester: stderr and json loads fixes

Signed-off-by: Rohit Yadav <rohit.ya...@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/commit/a1e1023e
Tree: 
http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/tree/a1e1023e
Diff: 
http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/diff/a1e1023e

Branch: refs/heads/master
Commit: a1e1023e04f7878e901d98af658ce3d9242fa214
Parents: fd32746
Author: Rohit Yadav <rohit.ya...@shapeblue.com>
Authored: Fri Oct 31 14:59:09 2014 +0530
Committer: Rohit Yadav <rohit.ya...@shapeblue.com>
Committed: Fri Oct 31 14:59:09 2014 +0530

----------------------------------------------------------------------
 cloudmonkey/requester.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/blob/a1e1023e/cloudmonkey/requester.py
----------------------------------------------------------------------
diff --git a/cloudmonkey/requester.py b/cloudmonkey/requester.py
index 91b61a2..eaf9de9 100644
--- a/cloudmonkey/requester.py
+++ b/cloudmonkey/requester.py
@@ -43,6 +43,7 @@ def logger_debug(logger, message):
 
 def writeError(msg):
     sys.stderr.write(msg)
+    sys.stderr.write("\n")
 
 
 def login(url, username, password):
@@ -218,7 +219,7 @@ def monkeyrequest(command, args, isasync, asyncblock, 
logger, url,
 
     def process_json(response):
         try:
-            response = json.loads(unicode(response))
+            response = json.loads(response, "utf-8")
         except ValueError, e:
             logger_debug(logger, "Error processing json: %s" % e)
             writeError("Error processing json: %s" % e)

Reply via email to