aboutsummaryrefslogtreecommitdiff
path: root/steuermann/rexec.py
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2016-07-03 12:58:50 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2016-07-03 12:58:50 -0400
commit4b7c318aad84b5274f11e7f82da84241314baed3 (patch)
treea3f3e5704d13e28b640649f960db1efaf7e09bd5 /steuermann/rexec.py
parent5651d5c9725fd2ef2f292a9500c177318cbf20ca (diff)
downloadsteuermann-4b7c318aad84b5274f11e7f82da84241314baed3.tar.gz
Python 3k compat
Diffstat (limited to 'steuermann/rexec.py')
-rw-r--r--steuermann/rexec.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/steuermann/rexec.py b/steuermann/rexec.py
index 013dc94..81c55af 100644
--- a/steuermann/rexec.py
+++ b/steuermann/rexec.py
@@ -39,9 +39,9 @@ def run( host, cmd, password, directory ):
req = urllib2.Request(url, data)
try :
f = urllib2.urlopen(req)
- except urllib2.HTTPError, e:
- print "HTTP ERROR",e.code
- print e.read()
+ except urllib2.HTTPError as e:
+ print("HTTP ERROR",e.code)
+ print(e.read())
return 1
while 1 :
s = f.read(2048)
@@ -64,11 +64,11 @@ def upload( host, filename, password, directory) :
req = urllib2.Request(url, data)
try :
f = urllib2.urlopen(req)
- except urllib2.HTTPError, e:
- print "HTTP ERROR",e.code
- print e.read()
+ except urllib2.HTTPError as e:
+ print("HTTP ERROR",e.code)
+ print(e.read())
return 1
- print f.read()
+ print(f.read())
f.close()
return 0
@@ -86,7 +86,7 @@ if __name__ == '__main__' :
password = open(opt['-f'],'r').readline().strip()
if not ( '-h' in opt ) :
- print "must give host name with -h"
+ print("must give host name with -h")
sys.exit(2)
host = opt['-h']
if '-d' in opt :
@@ -97,7 +97,7 @@ if __name__ == '__main__' :
if opt['-u'] :
ex = 0
for x in args :
- print "UPLOAD", x
+ print("UPLOAD", x)
ex |= upload(host = host , filename=x, directory=directory, password=password)
sys.exit(ex)
else :