Python Programming, news on the Voidspace Python Projects and all things techie.

VMWare Windows

emoticon:torch Yesterday [1], I did a very cool thing with the VMWare player.

This allows you to create a virtual computer running within your current setup. You can run Windows in Linux, Linux in Windows, or Windows in Windows (etc).

They distribute pre-built Linux environments - but can't do the same with Windoze systems, for obvious commercial-copy-thingy reasons.

I followed the easy-simple-straightforward instructions by John Bokma to install windows as a VMWare player file.

There are several very cool things about this.

When you setup the file you specify how much memory your virtual machine will have, and the maximum file size it can reach. This maximum filesize is the size of harddrive the virtual computer thinks it has.

I setup mine with a 2gig hard drive and 256meg of ram. You'll need a windows XP CD [2] to do this. You then have to do a fresh windows install. This takes a bit longer than normal - but the actual running speed is more than acceptable.

VMWare will recognise all your hardware, and if you run with a 800x600 screen size, it will fit nicely in a window on your desktop.

The part I thought was really cool, is that the virtual computer appears on your network [3]. This means you can share a couple of directories and easily swap files between the two computers. (The virtual computer shares your audio and input devices, can access USB devices and the CD drive - but it doesn't share the hard drive with the 'mother computer').

This means I have a Python 2.4 build environment and a Python 2.3 build environment on the same machine. A Python 2.2 one will follow soon. Cool

I've already built a test version of Movable Python using this [4]. It would also be useful for compiling Windows 2.3 installers of modules.

[1]All my troubles seemed so far away...
[2]A legal one of course Wink - although this is still legally dubious.
[3]I'm running a small LAN - but so long as you have a network adaptor it will probably work anyway.
[4]I'm working on a new release - the new one may be non-free I'm afraid.

Like this post? Digg it or it.

Posted by Fuzzyman on 2005-12-09 09:11:39 | |

Categories: ,

SVN Update

emoticon:knot I didn't get much coding done last night. I spent my coding time chatting to the boys at river. Much more fun. Smile

What I did achieve yesterday was finally updating the SVN repository.

I've managed to confirm that my problems with SVN are due to the way windows treats the svn files as system files. DirWatcher, intermittently has problems overwriting these files - and mangles my working copy.

I've found a good workaround though.

That means that rest2web and friends are now up to date in subversion.

The version of odict in the repository is buggy though. New release - and it's good Wink - to follow imminently.

Like this post? Digg it or it.

Posted by Fuzzyman on 2005-12-08 13:06:00 | |

Categories: , ,

Job Hunting

emoticon:restart As of today I'm officially looking for work as a programmer. Smile

I'd prefer to work with Python, doing web-development. But I'm willing to learn (more-or-less) any language/development environment.

Money isn't particularly an issue, but I'm looking for work in the Northampton (UK) area. I'm also looking for work four days a week, so I can stick with my job at the Jesus Centre.

These factors could limit my choices. I'm definitely worth it though. Laughing

I need to polish up my CV before I start submitting it to local companies. There are a lot more computer firms in the area than I expected.

Like this post? Digg it or it.

Posted by Fuzzyman on 2005-12-06 15:07:47 | |

Categories: , ,

Replace in Files

emoticon:bugs SPE is a nice IDE, but it lacks a replace in files dialog. So does the text editor I'm stuck with [1].

As usual, Python is the best tool in my toolkit - and it's trivial to hack together a small script that does this. Especially using pathutils. Smile

# replace in files
import os, sys
from pathutils import *

A simple 'replace in files' script.
Given a starting directory it will recursively go through all files,
replacing strings in the file types you've chosen.

Set the four variables :

* replace_types - a list of file types you want changing
* directory - directory to start in
* find - the string to find
* replace - the string to replace it with

replace_types = ['.html', '.htm', '.txt', '.shtml',
    '.shtm', '.ini']

directory = '.'
find = 'find this...'
replace = 'and replace it with this...'

fname = os.path.split(sys.argv[0])[1]
for f in walkfiles(directory):
    if f.endswith(fname):
    ext = os.path.splitext(f)[1]
    if not ext in replace_types:
    in_file = readbinary(f)
    out_file = in_file.replace(find, replace)
    if in_file != out_file:
        print f
        writebinary(f, out_file)
[1]I can't install prorams on this machine. I use notepad++, which isn't bad - and doesn't need to be installed.

Like this post? Digg it or it.

Posted by Fuzzyman on 2005-12-06 10:10:20 | |

Categories: , ,

Pythonutils Mailing List

emoticon:noise Pythonutils has a new mailing list. This is a support and discussion forum for all the Pythonutils modules, packages, applications, and CGI scripts.

The new group is a google group :

This should be low traffic, and is the right place for support, bug-reports, feature requests, and discussion of all the code available from Voidspace.

Like this post? Digg it or it.

Posted by Fuzzyman on 2005-12-06 09:10:44 | |

Categories: ,

Ordered Dictionary - 0.2.0

emoticon:test_tubes After much experimentation I'm gingerly releasing odict 0.2.0.

This adds to the Ordered Dictionary :

  • Slicing
  • Slice assignment
  • Slice deletion
  • Better __repr__
  • Several sequence methods - like index, sort, reverse, insert
  • The sequence attribute is deprecated - now use the keys method to set the ordering

There is also a new class - SequenceOrderedDict. This has custom callable sequence objects in place of the keys, values, and items methods. They behave just like the methods, but you can also treat them directly like sequences.


Immediately after releasing I've discovered a bug in slice assignment.

If the slice you are assigning from contains keys in the slice being replaced - it can lose data. Sad

This will be fixed shortly, it might mean making slice assignment strict - so that it's not possible to overwrite keys during a slice assignment.

Like this post? Digg it or it.

Posted by Fuzzyman on 2005-12-05 09:40:47 | |

Categories: ,

pathutils and cgiutils

emoticon:world I've just done updates to pathutils and cgiutils.

These have extra code based on last weeks hacking. Smile

The blurb :

Pathutils contains various functions for working with files and paths. This includes (amongst other thing) :

  • Easy ways to iterate over files and directories
  • A function to calculate a relative path from one location to another
  • Several 'convenience' file reading/writing functions
  • py2exe directory support
  • A function for pretty printing file sizes
  • A simple solution to cross-platform file locking
  • Import from a specific location

See the pathutils Homepage.

CGI utils has (guess what... Question ) various functions for use with CGI. It contains functions to do things that every CGI has to cope with. They are most useful for simple scripts, where a full blown framework would be too cumbersome.

It includes (amongst other thing) :

  • Functions for receiving form submissions
  • Cross platform functions to send emails (including creating HTML emails)
  • A basic templating system
  • A DNS blacklist lookup
  • A function to generate a menu line for pages with lots of results

See the cgiutils Homepage.

Like this post? Digg it or it.

Posted by Fuzzyman on 2005-12-05 09:33:07 | |

Categories: , ,

akismet 0.1.2

emoticon:acrobat I've written full docs for my Python interface to the Akismet API. I've also slightly updated it.

Akismet is a web service to combat comment spam. It will soon be used by my guestbook (update nearly complete).

The REST API to akismet is very simple (kudos to the akismet folk) - so the Python interface is nice and clean.

Like this post? Digg it or it.

Posted by Fuzzyman on 2005-12-05 09:28:25 | |

Categories: ,

ConfigObj 4.0.2

emoticon:dove ConfigObj 4.0.2 is now available.

This is a minor bugfix release - fixing a bug in create_empty.

There have been a couple of questions on the mailing list about validation recently. It's nice to see validate getting used, it's a nice system.

As a result of one of the discussions I'll probably be adding an extra option to the ConfigObj.validate method in the next few days.

Unfortunately SVN is still out of date, I hope to fix this tomorrow.

Like this post? Digg it or it.

Posted by Fuzzyman on 2005-12-05 09:23:21 | |

Categories: ,

Introdução Programacao Orientada Objetos

emoticon:paper Introduction to OOP With Python has now been translated into Brazilian Portuguese.

The translation has been done by a gentleman called Rodrigo Nishino. I'd love to say he's done a brilliant job, but unfortunately I don't understand a word of it. Laughing

Like this post? Digg it or it.

Posted by Fuzzyman on 2005-12-05 08:47:00 | |

Categories: ,

Hosted by Webfaction