logo
Loading...

無法讀取圖片InvalidSchema: No connection adapters were found for '['http://farm1.static.flickr.com/145/430300483_21e993670c.jpg' - Cupoy

將result改成 result =img2arr_fromURLs('http://farm1.s...

result

無法讀取圖片InvalidSchema: No connection adapters were found for '['http://farm1.static.flickr.com/145/430300483_21e993670c.jpg'

2020/02/29 04:36 AM
機器學習新手論壇
陳俊凱
觀看數:0
回答數:1
收藏數:0
result

將result改成 result =img2arr_fromURLs('http://farm1.static.flickr.com/145/430300483_21e993670c.jpg') 就可以讀取

但是 若result = img2arr_fromURLs(df[0:5][0].values)

卻一直錯誤

是哪邊需要修改嗎



def img2arr_fromURLs(url_list, resize = False):

   """

   請完成這個 Function

   Args

       - url_list: list of URLs

       - resize: bool

   Return

       - list of array

   """

   response = requests.get(url_list)        

   try:

       img = Image.open(BytesIO(response.content))                

   except (OSError, NameError):

       print("讀取 <失敗>")

#            print('OSError')

   else:

       print("讀取 <成功>")


   return img_list

#result = img2arr_fromURLs('http://farm1.static.flickr.com/145/430300483_21e993670c.jpg')

result = img2arr_fromURLs(df[0:5][0].values)

print((df[0:5][0].values))


InvalidSchema: No connection adapters were found for '['http://farm1.static.flickr.com/145/430300483_21e993670c.jpg'
'
http://farm2.static.flickr.com/1005/3352960681_37b9c1d27b.jpg'
'
http://farm1.static.flickr.com/27/51009336_a9663af3dd.jpg'
'
http://farm4.static.flickr.com/3025/2444687979_bf7bc8df21.jpg'
'
http://img100.imageshack.us/img100/3253/forrest004fs9.jpg']'