Answer the question
In order to leave comments, you need to log in
How to add an image to a pip package?
The task was to automate the generation of a QR code with a unique style.
In the middle of the QR code, the organization's logo should be full of colors (this is a png image).
We need to create a module for PyPi, which, when installed via pip, will generate a QR code with the style
Module wrote, but images are not loaded into the package.
How to make the logo image upload for the module to work?
How I did:
from PIL import Image
from io import BytesIO
import requests
byteImgIO = BytesIO(requests.get("correct_url").content)
byteImgIO.seek(0)
logo1 = Image.open(byteImgIO)
Answer the question
In order to leave comments, you need to log in
You must specify the full and working address of the image. For example,
in a browser it might look like this:
site.ru/image/1.png
but the full path to the image is:
site.ru/upload/bbb66f0a05a24e79a1284abbb8358426.png
Your code works, but if you specify the wrong path, you will get the same error.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question