Ben Chuanlong Du's Blog

It is never too late to learn.

Fix Version Confliction of the Six Package

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

ERROR: jsonschema 3.1.1 has requirement six>=1.11.0, but you'll have six 1.10.0 which is incompatible.

sudo pip3 install six -U

Update a Line in Standard Output

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

The trick is to use \r (return) instead \n (return and new line). I will use Python to illustrate. The following Python code

:::Python import sys

for idx in range(5 …

Understand the Design of Python

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Design

  1. There is no constant variables in Python. If you need a constant variable in Python, just define one and never change it. It is suggested that you use UPPER_WITH_UNDERSCORE naming …

Calling Shell from Python

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

  1. subprocess.run is preferred to the function os.system for invoking shell commands. For more discussions, pleaser refer to [Hands on the Python module subprocess]https://www.legendu.net/en/blog …

Tips on Monkey Patching in Python

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

A MonkeyPatch is a piece of Python code which extends or modifies other code at runtime (typically at startup).

A monkey patch is a way for a program to extend or …

Use Qt in Python

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

PyQt5 vs PySide2

https://www.reddit.com/r/Qt5/comments/a3zt3j/eli5_pyqt5_pyside2_which_one_to_use/

Both PyQt5 (developed by Riverbank) and PySide2 (official Python bindings from Qt) are great. They have very similar APIs …