🐛 BUG: Python Project Bug
Which Cloudflare product(s) does this pertain to?
Workers for Platforms
What version(s) of the tool(s) are you using?
3.63.2 Wrangler
What version of Node are you using?
20.13.1
What operating system and version are you using?
Windows 11
Describe the Bug
Observed behavior
Showing this error "Uncaught Error: PythonError: Traceback (most recent call last): File "/lib/python312.zip/_pyodide/_base.py", line 629, in pyimport_impl res = import(stem, fromlist=fromlist) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/session/metadata/entry.py", line 1, in
Expected behavior
Won't show any errors
Steps to reproduce
Please provide the following:
- python worker
- no changes made in any other section
- this is the code "import requests from io import BytesIO from PIL import Image from flask import Flask, request, send_file
app = Flask(name)
@app.route('/overlay', methods=['GET']) def overlay_image(): base_image_url = request.args.get('base') overlay_image_url = 'https://www.overlayimage.png'
response = requests.get(base_image_url)
base_image = Image.open(BytesIO(response.content))
response = requests.get(overlay_image_url)
overlay_image = Image.open(BytesIO(response.content))
if base_image.mode != 'RGBA':
base_image = base_image.convert('RGBA')
if overlay_image.mode != 'RGBA':
overlay_image = overlay_image.convert('RGBA')
overlay_image = overlay_image.resize(base_image.size, Image.ANTIALIAS)
combined_image = Image.alpha_composite(base_image, overlay_image)
image_io = BytesIO()
combined_image.save(image_io, 'PNG')
image_io.seek(0)
return send_file(image_io, mimetype='image/png')
if name == 'main': app.run(host='0.0.0.0', port=8000)" in the entry.py
- showing error when deploying
Please provide a link to a minimal reproduction
No response
Please provide any relevant error logs
No response
ModuleNotFoundError: No module named 'requests'
Did you specify requests (and your other imports) in a requirements.txt file?