Logo TheBeArsenal

Python | Technical Handbook

Install virtualenv for Python3

sudo apt-get install python3-pip
sudo pip3 install virtualenv
virtualenv -p python3 myenv
source venv/bin/activate

Search and Replace a word in the file using Python

# Read and save file content
with open('file.txt', 'r') as file :
filedata = file.read()
# Replace words with new ones.
filedata = filedata.replace('abc', 'def')
# Overwrite the file with new contents
with open('file.txt', 'w') as file:

FLASK_ENV = 'development' not activating debug mode

Along with FLASK_ENV = 'development', add FLASK_DEBUG = 1 in the flask env file. Or run this command - export FLASK_DEBUG=1

Flask - oauthlib.oauth2.rfc6749.errors.MismatchingStateError: (mismatching_state) CSRF Warning! State not equal in request and response.

Use 'Flow' instead of' 'InstalledAppFlow' from 'from google_auth_oauthlib.flow'