「操作超時」當使用Python,使通過隱性FTPS到ShareFile的連接我得到以下幾點:隱FTPS到ShareFile失敗,並在Python
Traceback (most recent call last):
ftps.storbinary("STOR /file, open(file, "rb"), 1024)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ftplib.py", line 769, in storbinary
conn.unwrap()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 791, in unwrap
s = self._sslobj.shutdown()
SSLError: ('The read operation timed out',)
我tyFTP(必需的,因爲隱含FTPS不直接在ftplib中支持)類來自這裏:Python FTP implicit TLS connection issue。下面的代碼:
ftps = tyFTP()
try:
ftps.connect(‘ftps.host.domain’, 990)
except:
traceback.print_exc()
traceback.print_stack()
ftps.login(‘uid', ‘pwd')
ftps.prot_p()
try:
ftps.storbinary("STOR /file", open(file, "rb"), 1024)
# i also tried non-binary, but that didn't work either
# ftps.storlines("STOR /file", open(file, "r"))
except:
traceback.print_exc()
traceback.print_stack()
這個問題已經被以前問,但所提供的唯一解決辦法是破解Python代碼。這是最好的/唯一的選擇嗎?
ShareFile upload with Python 2.7.5 code timesout on FTPS STOR
ftplib - file creation very slow: SSLError: The read operation timed out
ftps.storlines socket.timeout despite file upload completing
還有關於python.org這個問題的討論老:http://bugs.python.org/issue8108。有人建議,這是一個模糊的情況,難以解決(也許從來沒有?)
請注意:我會添加評論到現有的問題,但我的聲譽不夠高評論(新堆棧交換用戶)。