Category: Python

49 posts
Python
2025-05-27 08:55 (17 months ago)
[Outdated] Using Selenium Remote (Selenium Grid) with browser_use

This is sample code for using Selenium Remote Grid in headful mode with `browser_use`. The sample also includes specifying the browser window’s viewport size.

Python
2025-05-21 03:10 (18 months ago)
Obtain HttpOnly=True Session Cookies from Services Logged in via Browser-Use

Pitfalls when passing `--headless` or `-profile` to Selenium Firefox, and the right way to use `selenium.webdriver.FirefoxOptions`.

Python
2025-05-21 02:50 (18 months ago)
Fix: Python 3.13 SSL error 'Basic Constraints of CA cert not marked critical' (VERIFY_X509_STRICT)

Python 3.13 enabled VERIFY_X509_STRICT by default, triggering "SSL: CERTIFICATE_VERIFY_FAILED certificate verify failed: Basic Constraints of CA cert not marked critical" against self-signed CA certs. Workaround: disable VERIFY_X509_STRICT in SSLContext.

Python
2024-07-03 00:23 (2 years ago)
Template Code for Thread Parallelism and Process Parallelism in Python

Expose the Selenium Chromium / ChromeDriver `--remote-debugging-port` (CDP port) outside the container for external clients to connect.

DjangoPython
2024-03-28 00:41 (2 years ago)
The "first" and "second" Arguments of assertEqual in Django's Unit Tests are Actually "expected" and "actual"

When looking at the assertEqual method in Django's unit tests, the first argument is named 'first' and the second argument is named 'second'. It appears that there is no difference in the usage of these variables.

DjangoPython
2024-03-24 04:53 (2 years ago)
Fix: pipenv install fails with AttributeError: module 'pkgutil' has no attribute 'ImpImporter' (Python 3.12)

pipenv install throws "AttributeError: module 'pkgutil' has no attribute 'ImpImporter'" on Python 3.12. Run `python3 -m ensurepip --upgrade` in both the global and virtualenv, or rebuild the pipenv environment.

PythonMicrocontrollers
2023-12-24 09:20 (2 years ago)
Using CircuitPython on the HW-394 ESP-WROOM-32 (ESP32) Development Board

A memo about purchasing a development board featuring the ESP-WROOM-32 module, which appears when searching for "ESP32" on AliExpress, and has "HW-394" written on the board.

PythonRaspberry-Pi
2023-11-21 02:51 (2 years ago)
When Copying Files to Raspberry PI Pico or RP2040 on Mac OS Sonoma Results in Input/Output Error

Here is the solution for resolving Input/output errors or Error code -36 that may occur when trying to copy files to an RP2040 microcontroller board or Raspberry Pi Pico while developing on Mac OS Sonoma.

DjangoPython
2023-11-09 03:39 (3 years ago)
Fix: symbol not found in flat namespace '_mysql_affected_rows' when importing MySQLdb on Apple Silicon

Fix `symbol not found in flat namespace '_mysql_affected_rows'` when importing MySQLdb in Python — rebuild mysqlclient against the right MySQL client library.

Python
2023-03-29 05:31 (3 years ago)
Trying to Install npm install fibers (node-fibers) Results in ValueError: invalid mode: 'rU' While Trying to Load binding.gyp

Fix `npm install fibers` (node-fibers) failing with `ValueError: invalid mode: 'rU'` — its `setup.py` uses a deprecated flag, so install with Python 3.10 or older.

Python
2023-03-06 07:01 (3 years ago)
Remove 4-byte Characters from Strings in Python

Configure a macOS Service (Quick Action) that copies the absolute path of the file or folder open in Finder to the clipboard.

Python
2023-01-03 02:21 (3 years ago)
Output and Clear Text in Terminal with Python

Flash CircuitPython onto an ESP32 dev board (HW-394 / WROOM-32) and drive I/O in Python — bootloader mode and REPL connection.

Python
2022-12-02 09:02 (3 years ago)
When Using Libraries Like Fabric and Paramiko, "Authentication (publickey) failed." Error Occurs During Server Login

When connecting to an SSH server using Python libraries like Fabric or Paramiko, if the versions are outdated, you may encounter the error "Authentication (publickey) failed."

Python
2022-10-31 12:43 (4 years ago)
A Python Script to Automatically Update ChromeDriver

I wrote a script to download the version of chromedriver that matches the currently installed version of Chrome.

Python
2022-10-09 02:16 (4 years ago)
Code for Creating a Logger When Making Python Command Line Tools

Build an OpenVPN server that routes all clients in a segment through the VPN — from CA cert issuance to distributing `client.ovpn`.

Python
2022-09-19 07:31 (4 years ago)
Fixing the Issue of Separated Voiced Marks in Folder Names on Mac When Outputting from Python

Debug and work around `multipart/form-data` boundary issues during file upload in macOS WebKit (WKWebView / Safari).

Python
2022-09-05 00:49 (4 years ago)
If "pipenv install" Results in RuntimeError: location not created nor specified

Fix `pipenv install` failing with `RuntimeError: location not created nor specified` — remove the venv with `pipenv --rm` and let pipenv recreate it.

DjangoDockerPython
2022-09-03 11:03 (4 years ago)
Changed Django's Docker Environment from Alpine + uWSGI to Debian + Daphne → Ended up with uvicorn After All

Why switch a Django Docker image from Alpine + uWSGI to Debian + Daphne (ASGI), with example Dockerfile and Kubernetes manifest changes.

Python
2022-08-11 15:06 (4 years ago)
Fix: cryptography fails to install in Alpine Linux Docker images (3 workarounds)

Building cryptography with Rust on Alpine is slow and can fail on Apple Silicon. Workarounds: build with Rust, use apk py3-cryptography, or skip Pipfile.lock.

Python
2022-04-02 05:32 (4 years ago)
Digital Signage: Python Selenium Script to Launch Chrome in Kiosk Mode

A script to open a website and log in to Google using Python Selenium