can't download images using google_images_search on docker

27 views Asked by At

have a problem with downloading pictures from google with google_images_search python lib. it works perfectly and downloads images on my pc, but when i try to run the same script in docker it shows me, that there's no file like this in the directory

Traceback (most recent call last):
  File "/app/main1.py", line 88, in <module>
    send_message()
  File "/app/main1.py", line 83, in send_message
    memepath = gen_meme()
  File "/app/main1.py", line 53, in gen_meme
    image = Image.open(f"{directory}\img\{custom_name}.jpg")
  File "/usr/local/lib/python3.9/site-packages/PIL/Image.py", line 3236, in open
    fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: "/app\\img\\TUPOJ PAREN'.jpg"

tried finding this error on google but didnt find any specific or similar problems

    gis.search({'q': img, 'num': 1, 'imgType': 'photo', 'fileType': 'jpg'}, path_to_dir=f'{directory}\img', custom_image_name=custom_name, width=600, height=400) # the line with downloading the image
    image = Image.open(f"{directory}\img\{custom_name}.jpg") # the line where the error is. this line modifies the image with pillow
0

There are 0 answers