Unable to import lambda_handler in AWS Lambda - pandas

I am trying to run pandas code in AWS Lamdba by following https://medium.com/#korniichuk/lambda-with-pandas-fd81aa2ff25e.
After zipping the folder and running the lambda code below was my error.
{
"errorMessage": "Unable to import module 'lambda_function'"
}
So thought to try a simple code without any libaries. Once I zipped and uploaded the folder I found this..
As the zip size is small, I can move the file inside inline-editor. But it's not possible for larger zip folder once I import all my libs in the zip.
How can I zip the folders properly and uploading it?
Does the lambda function name and zip file name should be same?

Put the lambda_function.py in the root of the directory. Your file is inside a directory called to.
Your folder view should look something like

Related

PyCharm can't find files after moving code to a sub-folder

Initially, I have a folder 'Project' containing my scripts and a configuration file.
script1.py
script2.py
config.yml
In 'script1.py', I need to import 'script2.py'. Everything was fine.
After moving all the scripts to a sub-folder 'Project/code', it reports error "can't find script2". Then after searching around, I followed the advice and marked the sub-folder 'Project/code' as the source root and add a 'init.py' in the sub-folder. Now it reports error "can't find config.yml". In my scripts, I need to import the config.yml file.
I prefer not to provide a absolute path in front of the config.yml file, as the scripts are sync with a remote server.

Unable to load local files using import/require

I can't load local files (jpg, png, json...) with either
import img from '../../../../assets/images/myImage.png';
require('../../../../assets/images/myImage.png');
With import VS Code notifies me that the module is not found. I can't see files in folders. What am I doing wrong?
At first you would check if file path is correct.
If file path is correct you load it simply.
(../../../../ is bad statement for files loading.)
The step is below
Please define package.json file into assets folder.
The content of package.json file looks like this
{
"name" : "#assets"
}
then you can load the file which is in assets folder like this
const img = require('#assets/images/myImage.png');

Microsoft Kaizala custom action import not working

Wehn we try to import the custom action to Kaizala portal, it throw "missing package.json" error,the package.json exist in the zip.
Zip all the files into a single zip file
Make sure that the zip does not include another directory inside it but the files are
present at the root directory of the zip
For more help you may go through this link (Microsoft Docs) :-
https://learn.microsoft.com/en-us/kaizala/actions/tutorial
We find this error, mostly when we make mistake of zipping the folder, rather zipping only the folder contents.
If you're using Windows do not select Custom Action Source Folder to zip.
Go inside the Custom Kaizala Action folder you created and Select All then try zipping.
Check Practice Tutorial: Creating a new Kaizala Action
Step 9: Create the Kaizala Action package
Zip all the files into a single zip file
Make sure that the zip does not include another directory inside it – but the files are present at the root directory of the zip

I cannot install PhpWord Yii

I have tried to install PhpWord to yii. I have downloaded zip file and extracted it into extentions folder:
extenstions
--PHPWord
--PHPWord.php
However, I cannot make it to run. I got following error:
include(PHPWord.php): failed to open stream: No such file or directory
How can i solve it?
After extracting the file in extension folder, you have to import that file in controller.
Yii::import('ext.phpword.PHPWord');
First of all, you didn't say if it's Yii 1 or 2. They have different autoloading methods.
Second, you have extracted it into extension folder, and I assume your file where you want to include it is in a completely different folder.
You should do it like this
include('/full/path/to/PHPWord.php');
You need either absolute or a relative path to the file (I suggest using abosulte path (the one I used as an example).
Relative path means the path to the file you want to include compared to where your file, in which you are including it, is.

File Path is not absolute-selenium -AWS instance

Functionality-Uploading a file.
When I run my code to upload a file in AWS instance, absolute path of the file which I get is like /home/ec2-user/project/src/.../filename. If the script tries to upload the file to the application under test with above path I get file path is not absolute error. Any suggestion on this.
Thanks in advance.