Posts

Showing posts from December, 2021

Issue: Openwhisk

Image
Error: {     "error": "An error has occurred: Error: Invalid constructor options. Missing api_key parameter or token plugin." } Steps to reproduce: 1. create js program proxy.js var openwhisk = require('openwhisk'); function main(params) {         if(params.password !== "secret") {                 throw new Error("Passoword incorrect");         }          var ow = openwhisk(); // not passing any value to constructor will result in error.         return {"status":"Logged in"}; } 2. Deploy:  wsk action create proxy proxy.js 3. invoke wsk action invoke proxy -p password secret --result Solution: 1. install openwhisk with npm package manager npm install openwhisk 2. pass parameter to openwhisk():                  var openwhisk = require('openwhisk'); function main(params) {         if(params.password !== "secret") {                 throw new Error("Passoword incorrect");         }          optio

Install virtual env in linux

 https://gist.github.com/Geoyi/d9fab4f609e9f75941946be45000632b # How to install virtualenv: ### Install **pip** first sudo apt-get install python3-pip ### Then install **virtualenv** using pip3 sudo pip3 install virtualenv ### Now create a virtual environment virtualenv venv >you can use any name insted of **venv** ### You can also use a Python interpreter of your choice virtualenv -p /usr/bin/python2.7 venv ### Active your virtual environment: source venv/bin/activate ### Using fish shell: source venv/bin/activate.fish ### To deactivate: deactivate ### Create virtualenv using Python3 virtualenv -p python3 myenv ### Instead of using virtualenv you can use this command in Python3 python3 -m venv myenv