Archive for January, 2010

Another script I had to come up with for my employer dealt with getting various bits and pieces of information about each of our user’s physical machines. We wanted to keep track of the CPU speed, hard drive sizes and the amount of RAM they had (among other things) so we would know when it was time to upgrade their computer. Gathering all the pieces from the various places on the internet was a royal pain, so to save you the trouble, I’m going to post what I found. Note that a lot of this code was taken from various recipes on ActiveState or mailing lists. Most of the following can be found almost verbatim in this recipe. (more…)

At my job, I do a fair amount of system administration scripting in Python. For example, almost all the login scripts are written in Python (with some of them ported from Kixtart). Over the years, I’ve been tasked with creating shortcuts to new applications that need to be placed on the user’s desktop or in their Start Menu or both. In this article, I will show you how to accomplish this task.

Note: This is a Windows-only article, so if you don’t use that OS, then this will probably bore you to tears. Heck, it might do that anyway! (more…)

A few days ago, I wrote an article about using ConfigObj with wxPython. The first question I was asked about the article regarded using a configuration file to generate the dialog. I thought this was an interesting idea, so I took a stab at implementing that functionality. Personally I think it would be probably be better to just create the dialog using XRC and use ConfigObj to help manage which dialog file is loaded that way. However, this was an intriguing exercise to me and I think you’ll find it enlightening too. (more…)

I recently starting using Michael Foord’s ConfigObj for one of our internal wxPython applications at work. When I wrote my other ConfigObj tutorial, I wanted to show you how I was using ConfigObj with my preferences dialog, but I didn’t want all my posts to include wx. In this article, I’ll just show you how easy it is to add a new preference setting in ConfigObj without wiping out your original ones and how to load and save them with a wxPython dialog. Now, let’s get to it! (more…)

PyCon 2010: Atlanta

PyCon USA 2010 will be held in Atlanta, Georgia this year, from February 19-21. There are also tutorial and sprint days that precede and follow the conference. Last year, I was told that my employer wouldn’t pay my way next time. So this year I had to decide if I would go all on my own. (more…)

Python comes with a handy module called ConfigParser. It’s good for creating and reading configuration files (aka INI files). However, Michael Foord (author of IronPython in Action) and Nicola Larosa decided to write their own configuration module called ConfigObj. In many ways, it is an improvement over the standard library’s module. When I first looked at ConfigObj’s home page, I thought it was well documented, but it didn’t seem to have any fully functional snippets. Since I learn from docs plus examples, I found it harder to get started using ConfigObj when the examples were unavailable. When I started writing this article, I was unaware that Michael Foord has already written his own tutorial on the subject; but I had made a promise that I would write my own, so that is what you will get to read today! (more…)