Category: Python

Python
2025-05-27 08:55 (9 months ago)

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 (9 months ago)

This article explains how to obtain an HttpOnly session cookie that is issued when logging into a web service using browser-use.

Python
2025-05-21 02:50 (9 months ago)

Here's an overview of the blog article translated into English: The article discusses how to avoid the `httpx.ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Basic Constraints of CA cert not marked critical (_ssl.c:1020)` error when making requests to a server using a self-signed certificate in Python 3.13. The error occurs because the certificate verification process fails due to the basic constraints of the CA certificate not being marked as critical. The article likely provides a step-by-step guide or workaround to bypass or resolve this SSL verification issue, ensuring successful communication with the server using the `httpx` library.

Python
2024-07-03 00:23 (20 months ago)

The only difference is whether to use `ThreadPoolExecutor` or `ProcessPoolExecutor`.

DjangoPython
2024-03-28 00:41 (23 months ago)

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 (23 months ago)

This blog post covers the steps to build a Python 3.12 environment and discusses how to create a new virtual environment using Pipenv. It focuses on a specific issue that might arise when running the `pipenv install` command, which results in the error: AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'? The post provides a detailed checklist and solutions to address this error.

PythonMicrocontrollers
2023-12-24 09:20 (2 years ago)

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)

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 (2 years ago)

Here is an English translation of the summary for a blog post on how to address the error "symbol not found in flat namespace '_mysql_affected_rows'" when attempting to use MySQLdb in Python: --- **How to Address the "symbol not found in flat namespace '_mysql_affected_rows'" Error When Using MySQLdb in Python** In this blog post, we will discuss the steps to resolve the error "symbol not found in flat namespace '_mysql_affected_rows'" that may occur when attempting to use the MySQLdb library in Python. This error typically arises due to issues with the MySQLdb installation or compatibility problems between the library and your system. We will explore various troubleshooting methods and provide detailed instructions to help you get MySQLdb running smoothly.

Python
2023-03-29 05:31 (2 years ago)

Here's the English translation of the summary of the Japanese blog article: "When trying to install 'npm install fibers (node-fibers)' and encountering the error 'ValueError: invalid mode: 'rU' while trying to load binding.gyp', you can resolve this issue by editing the 'node-gyp/gyp/pylib/gyp/input.py' file and removing the 'U' from the mode."

Python
2023-03-06 07:01 (2 years ago)

This is Python code to delete 4-byte characters from a string.

Python
2023-01-03 02:21 (3 years ago)

With the backspace sequence `\b`, you can erase printed characters.

Python
2022-12-02 09:02 (3 years ago)

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 (3 years ago)

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

Python
2022-10-09 02:16 (3 years ago)

Here is a memo on the code for creating a logger, which is used when making a simple daemon app in Python.

Python
2022-09-19 07:31 (3 years ago)

When trying to output directory names on a Mac, there are instances where diacritic marks (like dakuten) appear as separate characters. This issue arises due to differences between Unicode normalization forms NFC and NFD. It can be fixed using unicodedata.normalize.

Python
2022-09-05 00:49 (3 years ago)

When attempting to create a Python 3.10 environment using `pipenv install` and encountering the error "RuntimeError: location not created nor specified," it may be due to using the pipenv installed in a Python 3.9 environment. To resolve this issue, you should install pipenv in the Python 3.10 environment.

DjangoDockerPython
2022-09-03 11:03 (3 years ago)

Until now, I often created Django images using Alpine Linux and uWSGI, but there is a performance issue when running Python on Alpine Linux. This is a note on changing the Docker image configuration from Alpine to Debian and the HTTP server from uWSGI to Daphne + WhiteNoise.

Python
2022-08-11 15:06 (3 years ago)

When using version locking systems like Pipenv to set up a Python environment with an Alpine Linux Docker image, installations often encounter difficulties. If installing `cryptography` via Rust is unsuccessful (or too slow and thus undesirable), it is more effective to install `cryptography` via `apk` rather than through Pipenv.

Python
2022-04-02 05:32 (3 years ago)

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

Pythonmac
2022-01-03 11:15 (4 years ago)

Although creating a lock file with `pipenv lock` on an Intel Mac works without issues, attempting the same on an M1 (Apple Silicon) (ARM) Mac results in an error and the lock file cannot be created. However, by running `arch -x86_64 zsh` to emulate an x86_64 environment using Rosetta, `pipenv lock` executes successfully.

Python
2021-11-08 05:52 (4 years ago)

How to Avoid the #include <crc32c/crc32c.h> Error When Trying to Install google-crc32c==1.1.3 on Alpine Linux. If you encounter the error "ERROR: Failed building wheel for google-crc32c" or "error: command 'gcc' failed with exit status 1," setting the environment variable CRC32C_PURE_PYTHON=1 can help resolve the issue.

AWSPython
2021-10-15 11:53 (4 years ago)

When encountering the error "elasticsearch.exceptions.UnsupportedProductError: The client noticed that the server is not a supported distribution of Elasticsearch," it occurs when using the Python Elasticsearch library version 7.14 to connect to AWS OpenSearch/Elasticsearch.

Python
2021-10-10 09:45 (4 years ago)

Introducing code that uses `xml.etree.ElementTree` in Python to create and post XML data.

Python
2021-06-09 04:24 (4 years ago)

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 (4 years ago)

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)

Pipenv installation fails in Alpine's Dockerfile. The installation of cryptography 3.4.1 fails with the error: "ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly."

DjangoMySQLPython
2020-10-11 02:52 (5 years ago)

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 (7 years ago)

Here is the translated text of the Japanese blog article into English: ```python cookies = { cookie['name']: cookie['value'] for cookie in driver.get_cookies() } response = requests.get( url, headers={'User-Agent': self.user_agent}, cookies=cookies ) ``` Additional Note: Extracting zip

Python
2018-07-04 06:08 (7 years ago)

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

Python
2018-06-21 02:34 (7 years ago)

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

Python
2018-02-08 03:10 (8 years ago)

Building from source is easy

DjangoPython
2017-09-01 02:10 (8 years ago)

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

Python
2017-02-03 00:59 (9 years ago)

It often happens that I get a "permission denied" error on the server, so

DjangoPython
2016-06-20 08:35 (9 years ago)

Python 3, Django 1.9

Python
2015-12-01 02:02 (10 years ago)

Get the SSL certificate expiration period using timedelta

Python
2015-10-19 07:34 (10 years ago)

Up until now, I had been writing custom thread pools using threading.Thread, but I thought there must be something provided by Python already. So, I did some searching and found that multiprosessing.pool.Pool was exactly what I was looking for. Creating a process pool is super easy with it. What was I doing all this time?

Python
2015-10-16 07:35 (10 years ago)

I should have used multiprocessing.pool.Pool orz

Python
2015-08-11 02:06 (10 years ago)

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

Python
2015-06-17 11:08 (10 years ago)

Traceback (most recent call last): File "/Applications/Develop/PyCharm.app/helpers/pycharm/django_test_manage.py", line 51, in &lt;module&gt; django.setup() ... File "/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/importlib/__init__.py", line 109, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "&lt;frozen importlib._bootstrap&gt;", line 2254, in _gcd_import File "&lt;frozen importlib._bootstrap&gt;", line 2237, in _find_and_load File "&lt;frozen importlib._bootstrap&gt;", line 2226, in _find_and_load_unlocked File "&lt;frozen importlib._bootstrap&gt;", line 1200, in _load_unlocked File "&lt;frozen importlib._bootstrap&gt;", line 1129, in _exec File "&lt;frozen importlib._bootstrap&gt;", line 1471, in exec_module File "&lt;frozen importlib._bootstrap&gt;", line 321, in _call_with_frames_removed ... File "/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/ssl.py", line 97, in &lt;module&gt; import _ssl # if we can't import it, let the error propagate ImportError: dlopen(/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/lib-dynload/_ssl.so, 2): Symbol not found: _SSLv2_method Referenced from: /usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/lib-dynload/_ssl.so Expected in: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib in /usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/lib-dynload/_ssl.so I started getting this error.

Python
2015-03-02 10:46 (11 years ago)

Couldn't find the configuration item, so I'll use a monkey patch.

Python
2014-03-20 23:30 (11 years ago)

When running `pip install pillow`, you might encounter the following error:

Python
2014-01-29 10:41 (12 years ago)

When you start the program, a list of files is displayed in the editor. You can modify and save the list.

Python
2013-11-18 02:41 (12 years ago)

I wanted to write a logger-like class and wondered, "Which would be more readable, using a generator or a class?" So I wrote and compared both.

Python
2011-12-29 03:04 (14 years ago)

When I switched to MacOS Lion and was setting up my environment, I encountered the following error when running iPython:

Python
2011-06-10 17:02 (14 years ago)

I'm not very confident about the GTK part

Python
2011-06-09 08:37 (14 years ago)

# -*- coding: utf-8 -*-

Python
2011-06-07 16:23 (14 years ago)

# -*- coding: utf-8 -*-

Python
2011-06-03 16:34 (14 years ago)

```python

Categories

Archive