有IndentationError:意外缩进

时间:2015-03-27 22:53:10

标签: python

我的代码中有一个缩进错误,我不明白为什么。你能看出这里有什么问题吗?

如果删除print "hi"代码有效,但如果我不删除,我总会收到此错误:

这是错误:

print "hi"
    ^
IndentationError: unexpected indent

这是代码:

while True:
    while True:
        message = inputqueue.read()
        filename = ""
        if message is not None:
            inputqueue.delete_message(message)
            filename = message.get_body()
            print
            print "Got message %s from queue" % filename

    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"

0 个答案:

没有答案