handsome-sunset-98068
09/27/2022, 8:15 AMResponse
{
"errorMessage": "[Errno 2] No such file or directory: 'newcamera.png'",
"errorType": "FileNotFoundError",
"requestId": "2276ab1d-46e1-4c5f-ad34-18a5f75e3968",
"stackTrace": [
" File \"/var/task/lambdex_handler.py\", line 58, in handler\n return __RUNNER(*args, **kwargs)\n",
" File \"/var/task/test.py\", line 9, in lambda_handler\n file_length()\n",
" File \"/var/task/test.py\", line 2, in file_length\n with open('newcamera.png', 'rb') as f:\n"
]
}
repo link for reference.fast-nail-55400
09/27/2022, 8:41 AMresource
target to include the .png
file.handsome-sunset-98068
09/27/2022, 9:42 AMprojects/<proj1>/apps/<app1>/assets/<file.png>
$ ./pant roots
.
projects
so while opening the image in projects/<proj1>/apps/<app1>/helper.py
with open("projects/proj1/apps/app1/assets/file.png") as f:
f.read()
this works fine locally, but breaks on lambda
(file not found) - possibly cuz the projects is the root of the repo which not the related to the lambda package.
I tried changing in projects/<proj1>/apps/<app1>/helper.py
to:
with open("proj1/apps/app1/assets/file.png") as f:
f.read()
this works in lambda, but won't work locally.
How to set this up so that it works both ways without changing code?happy-kitchen-89482
09/27/2022, 1:52 PMhandsome-sunset-98068
09/27/2022, 3:18 PMhappy-kitchen-89482
09/27/2022, 5:39 PM