Category: Python

49 posts · Page 2
Pythonmac
2022-01-03 11:15 (4 years ago)
When pipenv lock Fails on M1 Mac

Fix `pipenv lock` failures on M1 (Apple Silicon) Macs — wheels for `grpcio` / `cryptography` may not exist on arm64, so use Rosetta or pin compatible versions.

Python
2021-11-08 05:52 (5 years ago)
How to Resolve Errors When Installing google-crc32c Version 1.1.3 or Higher on Alpine with Python

When installing `google-crc32c` ≥1.1.3 on Alpine Linux fails to build, work around it by setting CFLAGS to enable SSE4.2 explicitly.

AWSPython
2021-10-15 11:53 (5 years ago)
Resolving UnsupportedProductError in Python ElasticSearch When Using AWS ElasticSearch

Format a USB stick as FAT32 + MBR on a Mac — explicit MBR via `diskutil eraseDisk` arguments.

Python
2021-10-10 09:45 (5 years ago)
Creating and Posting XML with Python

Replace legacy log analyzers (Webalizer / Analog) with GoAccess for Apache / nginx access logs — sample configuration and example output.

Python
2021-06-09 04:24 (5 years ago)
Wait Until the Element Disappears with Puppeteer (Pyppeteer)

Here's an introduction to a code snippet that waits for an element to disappear, using Pyppeteer, which is Python's version of Puppeteer. The same approach should work similarly in Puppeteer's JavaScript version.

Python
2021-03-30 11:44 (5 years ago)
The Specified Version Was Not Installed with Pipenv

Even though the Pipfile specifies ```plaintext [packages] ... Werkzeug = "<1.0.0" ``` running ```plaintext pipenv install --system --skip-lock --dev --deploy ``` installs version 1.0.1.

Python
2021-02-08 14:34 (5 years ago)
If You Can't Install Python Cryptography, Install Rust with rustup

Fix screen redraw issues when Mac Quick Look or Finder content is displayed on a DisplayLink-connected screen.

DjangoMySQLPython
2020-10-11 02:52 (6 years ago)
NameError: name '_mysql' is not defined in Python (Django) (Especially During Local Development)

If a Django project that has been working until now fails to start after a long time with the following error: ``` version_info, _mysql.version_info, _mysql.__file__ NameError: name '_mysql' is not defined ```

Python
2018-10-11 12:31 (8 years ago)
Downloading Files with Requests Using Selenium Webdriver Session Cookies

Pass a logged-in session cookie from Selenium WebDriver into `requests` to download files that require a browser-bound session.

Python
2018-07-04 06:08 (8 years ago)
Reading BOM-Included TSV Files with Python

When you download a CSV from Amazon, it might sometimes be a TSV with a BOM.

Python
2018-06-21 02:34 (8 years ago)
Add SSL CA Certificate to Ubuntu and Use It with Python Requests

1. If the certificate is in DER format, convert it to PEM

Python
2018-02-08 03:10 (8 years ago)
Installing Python 3.5 on Ubuntu 14.04

Building from source is easy

DjangoPython
2017-09-01 02:10 (9 years ago)
What to Do When You Encounter AuthAlreadyAssociated with Django Social Auth

I'm writing this down because I always get flustered.

Python
2017-02-03 00:59 (9 years ago)
Disable geckodriver.log Output in Selenium Firefox

Impersonate a different user during Django debugging by swapping `request.session['_auth_user_id']` to test session-bound logic.

DjangoPython
2016-06-20 08:35 (10 years ago)
Outputting Shift-JIS CSV with Django

How to return a Shift-JIS (CP932) CSV download response from Django on Python 3 — write to StringIO as Unicode first, then encode to cp932 in one shot.

Python
2015-12-01 02:02 (10 years ago)
Retrieve SSL Certificate Expiration Date Using timedelta

Get the SSL certificate expiration period using timedelta

Python
2015-10-19 07:34 (11 years ago)
Write Parallel Processing Easily Using Process Pools

Parallelize CPU-bound Python work with `multiprocessing.Pool` / `ProcessPoolExecutor` — minimal patterns and common pitfalls.

Python
2015-10-16 07:35 (11 years ago)
Python Simple Thread Pool

I should have used multiprocessing.pool.Pool orz

Python
2015-08-11 02:06 (11 years ago)
Running Firefox with Selenium on Headless Linux for Automated Operations in Python

This is a method to launch Selenium from Python on a headless Linux system.

Python
2015-06-17 11:08 (11 years ago)
What to Do When You Can't Import `requests` (_ssl) in Python 3 on a Mac

Fix an `import requests` failure caused by a missing `_ssl` module in Python 3 on macOS — rebuild Python via pyenv so it links against the system OpenSSL.