vendredi 27 mars 2015

Having IndentationError: unexpected indent

Im having a indent error in my code and Im not understanding why. Can you see what is wrong here?


If I remove the print "hi" the code works, but if I dont remove I always get this error:


This is the error:



print "hi"
^
IndentationError: unexpected indent


This is the code:



while True:
while True:
message = inputqueue.read(wait_time_seconds=20)
filename = ""
if message is not None:
inputqueue.delete_message(message)
filename = message.get_body()
print
print "Got message %s from queue" % filename
break
else:
print "No message. Retrying in 20 seconds..."

print "hi"
s3 = boto.connect_s3()
bucket_name = "my_folder"
print "Accessing bucket with name: " + bucket_name
logging.info("Accessing bucket with name: " + bucket_name)
bucket = s3.get_bucket(bucket_name)
key = bucket.get_key(filename)
to_process_filename = "to_process_" + filename
key.get_contents_to_filename( to_process_filename )

print "hi"




Aucun commentaire:

Enregistrer un commentaire