0
在解釋 'urllib.request.urlretrieve' 這樣的工作帶來極大的:爲什麼urllib.request.urlretrieve沒有控制權轉移給下一個指令
Python 3.4.3+ (default, Oct 14 2015, 16:03:50)
[GCC 5.2.1 20151010] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib.request
>>>urllib.request.urlretrieve('https://download.owncloud.org/download/repositories/stable/Ubuntu_15.10/Release.key', 'Release.key')
('Release.key', <http.client.HTTPMessage object at 0x7fa008f76518>)
在此功能將無法正常工作:
def owncloudI():
print(ok('Installing OwnCloud...\n'))
urllib.request.urlretrieve('https://download.owncloud.org/download/repositories/stable/Ubuntu_15.10/Release.key', 'Release.key') #<---- stuck here
call(['apt-key', 'add', 'Release.key'])
rep = open('/etc/apt/sources.list.d/owncloud.list', 'a')
print('deb http://download.owncloud.org/download/repositories/stable/Ubuntu_15.10/', file=rep)
rep.close()
call(['apt-get', 'update'])
call(['apt-get', 'install', 'owncloud'])
使用sudo進行代碼啓動並在/ tmp cat中執行,因此我認爲所有權利都可以。也許有人解決了類似的問題。