The ConfigParser module is very useful for creating user-editable configuration files for your applications. The configuration files are broken up into sections, and each section can contain name-value pairs for configuration data. Value interpolation using Python formatting strings is also supported, to build values which depend on one another (this is especially handy for paths or URLs).
Read more at pymotw.com: ConfigParser
Tomorrow’s post will cover the ConfigParser module. Beyond that, I have a few more weeks planned out, and am looking for suggestions for which modules to cover next.
If you were stranded on a desert island, which standard library module would you want, and why?
This is a test post to see experiment with the code hightlighting output from pygments.org (as recommended by a couple of commenters on my previous post). Pygments produces HTML with CSS-based styling, so I have added a bunch of new styles to my blogger template. And I am including as a sample the same Python code posted earlier with the alternative syntax highlighting tool.
def main(self, *m3ufilenames): self.startRSS() self.generateChannelInfo() for line in fileinput.
This is a perfect example of being too close to a problem.
Some users of the FlipStart compact PC were having trouble pressing the tiny keys for Ctrl-Alt-Del to login or reboot Windows. Unfortunately, the hardware vendor decided that instead of fixing the operating system so it wasn’t necessary to press Ctrl-Alt-Del on the tiny keyboard, they would just add a special Ctrl-Alt-Del button.
For my PyMOTW series, I have found that I want to convert a lot of python source code to HTML. In a perfect world it would be easy for me to produce pretty XML/HTML and use CSS, but it is not obvious how to use CSS from Blogger. Instead, I am using a CLI app based on this ASPN recipe which produces HTML snippets that I can paste directly into a new blog post.
To start this series, let’s take a look at the fileinput module, a very useful module for creating command line programs for processing text files in a filter-ish manner. For example, the m3utorss app I recently wrote for my friend Patrick to convert some of his demo recordings into a podcastable format.
Read more at pymotw.com: fileinput
I am starting a new series of posts today that I am calling “Python Module of the Week” (PyMOTW). I have two goals for this:
to work my way though the standard library and learn something about each module to get into the habit of posting to the blog more regularly I will cheat a little, and start out with some modules that I already know something about. Hopefully that will give me enough of a head-start that I can keep up a fairly regular flow.
I had a report that version 1.2 of my codehosting package did not include all of the required files. It turns out I messed up the setup.py file and left out the templates, images, and CSS files. Oops.
In the process of trying to fix the setup file, I discovered that distutils does not include package data in sdist. Not a big deal, since I just created a MANIFEST.in file to get around it.
In no particular order:
Cull my Google Reader subscriptions. 364 is too many. Finish reading Dreaming in Code. Add tagging support to codehosting. Verify all of the domains under my control with Google Web Master tools. Create a Trac plugin for code reviews based on the process we use at work. Change the monitor feeds on CastSampler.com so they do not include items without enclosures. Enhance BlogBackup to save enclosures and images linked from blog posts.