我從來沒有用過Python,而且總共是n00b,但我試圖在Windows上使用Boto庫和Python 3在py上執行腳本。 。 這是腳本產生錯誤的部分:無法編輯的類型:無類型()> str()
latest_date = None
for key in bucket.list(prefix="meta-review/"):
done_file_match = re.match("^meta-review/([^/]+)/done$", key.key)
if done_file_match:
date = done_file_match.group(1)
latest_date = max(date, latest_date)
assert latest_date is not None, "No complete dump folder found!"
但是當我使用命令行我收到此錯誤信息作爲輸出執行腳本:
INFO:root:Connecting to Amazon S3
INFO:root:Looking for latest complete dump
Traceback (most recent call last):
File "*******.py", line 78, in <module>
download_latest(aws_access_key, aws_secret_key, args.dest_folder)
File "*******.py", line 41, in download_latest
latest_date = max(date, latest_date)
TypeError: unorderable types: NoneType() > str()
(顯然星號是隱私)。 任何人都可以告訴我在哪裏可以找到解決方案? 我注意到,有類似的錯誤已經報告,但我不明白要改變什麼。
任何想法?
你無法將'None'與'str'進行比較。 'max()'進行比較。就這樣。 – glglgl
順便說一句,什麼可以私人關於文件名? – glglgl
這是濫用'assert' –