Some ways to add python path

For running python code as modules under root a package, sys.path needs to have a full absolute path in the list of it that python can recognize the package location. There are some ways to do that as below. Related post is Consideration about python logging and file configuration(2) Environment MacOS Catalina 10.15.7 Python 3.9.7 1. Append path to sys.path from python code For checking sys.path, just print it.

Consideration about python logging and file configuration(1)

Python has a standard logging library. I used that with configuration file (.conf) that is useful for have configuration point with separating it from application code. Environment MacOS Catalina 10.15.7 Python 3.9.7 1. Simple file output for debugging A simple example for logging file with configuration is: logging.conf 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 [loggers] keys=root [handlers] keys=fileHandler [logger_root] handlers=fileHandler level=DEBUG [handler_fileHandler] class=handlers.

tox InterpreterNotFound error with pyenv

Environment MacOS Catalina 10.15.7 Python 3.9.7 Problem When running tox with pyenv virtual environment, an error is raised like 1 2 3 4 5 6 $ tox -r ... py37 create: /Users/tatsuro.homma/repo/a/lib/thrift/AltKankoku/.tox/py37 ERROR: InterpreterNotFound: python3.7 py38 create: /Users/tatsuro.homma/repo/a/lib/thrift/AltKankoku/.tox/py38 ERROR: InterpreterNotFound: python3.8 tox.ini 1 2 3 4 5 6 7 8 [tox] envlist=py27, py37, py38, py39 indexserver = default = https://hoge/simple deps = -rrequirements.txt [testenv] commands = python setup.

Hello Flask

Environment MacOS 10.15.7 Catalina 1. Install 1 pip3 install Flask 2. HTTP GET 2.1 Composition 1 2 3 4 5 6 7 (main directory) ├app/ │ ├templates/ │ │ └index.html │ ├static/ │ └app.py └run.py 2.2 Source code app/run.py 1 2 3 4 from app.app import app if __name__ == "__main__": app.run() app/app.py 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 from flask import Flask, render_template, request app = Flask(__name__) # @app.

Install Octave on Mac

When drawing plot by octave on Mac, I had an error like: 1 2 3 octave3.8.0 gnuplot> set terminal aqua enhanced title "Figure 1" size 560 420 font "*,6" dashlength 1 ^ line 0: unknown or ambiguous terminal type; type just 'set terminal' for a list Install to Mac with M1 Chip Environment 1 2 3 4 5 $ sw_vers ProductName: macOS ProductVersion: 12.0 BuildVersion: 21A344 tmbp:~ tato$ Install 1 2 3 4 brew update brew upgrade brew doctor brew install octave Install to Mac with Intel Chip Environment MacOS 10.

Express application with Mongoose

1 Environment Mac OS Catalina 10.15.7 1 2 3 4 5 6 7 $ node -v v14.17.0 $ npm -v 6.14.13 $ mongo --version MongoDB shell version v4.4.5 ... 2 Prerequisite Create database name: “news_db” on MongoDB. See: Install MongoDB and use commands 1 Install Mongoose At the project repository, 1 $ npm i mongoose -S 2 Set MongoDB on Node.