Sometimes I need to use some binary data (e.g. a bitmap image) in a Python
In a package, you can store this data portable in a
data subdirectory of
a modules using the
package_data argument of
This won’t work in a standalone script.
You can of course make your script into a package, but here I want to show an
Articles tagged with "python3"
Sometimes I need to use some binary data (e.g. a bitmap image) in a Python script. In a package, you can store this data portable in a
As an exercise, I wrote a small script to read the Atom feeds for some favourite youtube channels. Of course I could have installed a “real” feed-reader, but that would be overkill and not half as much fun. :-)
The question now is if we can reduce that? For that we’re going to use mmap to look at the mailbox, and call sysctlbyname(3) using ctypes to get the remaining system information. Note that
sysctlet al and the names used are specific to FreeBSD.
The ImageMagick suite has been in my software toolbox for years. It is my go-to tool for manipulating bitmap images. Over the years I have written several front-ends for specific tasks for in Python.
In general, I have used the subprocess module to launch
But now it is 2021. Py-wand is at 0.6.7 and it is time to try again.
Pelican is the static site generator that I use for my website. This allows me to write my website posts in almost plain text (actually a light-weight markup language named reStructuredText), which are then translated into HTML. As someone who has written his webpages in HTML by hand, I can tell you that this is definitely an improvement.
Although I use LaTeX for things that require high-quality typesetting, these days almost all my other writings are in reStructuredText.
The previous pelican version 3.7 was basically the last Python 2.7 application that I use. So now that pelican supports Python 3, I’m switching. Since Pelican 4 is not in the FreeBSD ports tree yet, I’m installing it myself.
As of 4.0.1, Pelican is now in the FreeBSD ports tree and I’m using the port
www/py-pelican. At the moment I’m still installing
In this article I will try to document how to with with the FT232H using Python on FreeBSD. I will be using the Adafruit FT232H breakout board.
Note that since I’m using FreeBSD, the library provided by FTDI doesn’t work. However, the library provided by Adafruit was written for Python 2, and doesn’t work with Python 3. I tried tinkering with it a bit to get it to work with Python 3, but that did not work out. In the end, I went with pyftdi since it doesn’t require a native library and it just works.
This article details how I used the Plantower PMS5003 particulate matter (“PM”) sensor on a PC or laptop, using an FT232H breakout board to make the connection.