Fix the py file for Python 3+

This commit is contained in:
Stormy
2014-07-29 23:56:24 -06:00
parent dd7473b026
commit 87fe8f3401

View File

@ -170,8 +170,8 @@ def get_calendar(username, base_url='https://github.com/'):
try: try:
page = urllib2.urlopen(url) page = urllib2.urlopen(url)
except (urllib2.HTTPError,urllib2.URLError) as e: except (urllib2.HTTPError,urllib2.URLError) as e:
print "There was a problem fetching data from {0}".format(url) print ("There was a problem fetching data from {0}" , format(url))
print e print (e)
raise SystemExit raise SystemExit
return json.load(page) return json.load(page)
@ -253,10 +253,10 @@ def save(output, filename):
f.close() f.close()
def main(): def main():
print TITLE print (TITLE)
print "Enter github url" print ("Enter github url")
ghe = raw_input("Enter nothing for https://github.com/ to be used: ") ghe = raw_input("Enter nothing for https://github.com/ to be used: ")
print 'Enter your github username:' print ('Enter your github username:')
username = raw_input(">") username = raw_input(">")
if ghe is None or ghe == "": if ghe is None or ghe == "":
git_base = "https://github.com/" git_base = "https://github.com/"
@ -266,10 +266,10 @@ def main():
git_base = ghe git_base = ghe
m = multiplier(max_commits(cal)) m = multiplier(max_commits(cal))
print 'Enter name of the repo to be used by gitfiti:' print ('Enter name of the repo to be used by gitfiti:')
repo = raw_input(">") repo = raw_input(">")
print 'Enter number of weeks to offset the image (from the left):' print ('Enter number of weeks to offset the image (from the left):')
offset = raw_input(">") offset = raw_input(">")
if offset == None: if offset == None:
offset = 0 offset = 0
@ -291,12 +291,12 @@ def main():
else: else:
match = 1 match = 1
print 'enter file(s) to load images from (blank if not applicable)' print ('enter file(s) to load images from (blank if not applicable)')
img_names = raw_input(">").split(' ') img_names = raw_input(">").split(' ')
images = dict(IMAGES, **load_images(img_names)) images = dict(IMAGES, **load_images(img_names))
print 'enter the image name to gitfiti' print ('enter the image name to gitfiti')
print 'images: ' + ", ".join(images.keys()) print ('images: ' + ", ".join(images.keys()))
image = raw_input(">") image = raw_input(">")
if image == None: if image == None:
image = IMAGES['kitty'] image = IMAGES['kitty']
@ -314,8 +314,9 @@ def main():
m*match,git_url=git_url) m*match,git_url=git_url)
save(output, 'gitfiti.sh') save(output, 'gitfiti.sh')
print 'gitfiti.sh saved.' print ('gitfiti.sh saved.')
print 'Create a new(!) repo at: {0}new and run it.'.format(git_base) print ('Create a new(!) repo at: {0}new and run it.' , format(git_base))
pause
if __name__ == '__main__': if __name__ == '__main__':
main() main()