Найти - Пользователи
Полная версия: Хуй Dick
Начало » Python для новичков » Хуй Dick
1
xeyalxx
Dick Хуй
JOHN_16
у вас есть диреткория imagis в той же директории что и программа?
ну и в коде записано folder_name = ‘img’, а в ошибке говорится про imagis (корректно на английском будет images)
Vintets
Нет папки ‘img’.

Можно проверять и если не существует создавать
 import os.path
import requests
import re
img_link = 'http://mirsofta.ru/screen/3493841820.png'
p = requests.get(img_link)
folder_name = 'img'
if not os.path.isdir(folder_name):
    os.makedirs(folder_name)
img_name = re.sub('^.*/', '', img_link)
with open(os.path.join(folder_name, img_name), 'wb') as out:
    out.write(p.content)

И путь лучше собирать через os.path.join(), а не \\
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB