Python Programming, news on the Voidspace Python Projects and all things techie.
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  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 . 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.
|||All my troubles seemed so far away...|
|||A legal one of course - although this is still legally dubious.|
|||I'm running a small LAN - but so long as you have a network adaptor it will probably work anyway.|
|||I'm working on a new release - the new one may be non-free I'm afraid.|
I didn't get much coding done last night. I spent my coding time chatting to the boys at river. Much more fun.
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 - to follow imminently.
As of today I'm officially looking for work as a programmer.
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.
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.
Replace in Files
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.
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',
directory = '.'
find = 'find this...'
replace = 'and replace it with this...'
fname = os.path.split(sys.argv)
for f in walkfiles(directory):
ext = os.path.splitext(f)
if not ext in replace_types:
in_file = readbinary(f)
out_file = in_file.replace(find, replace)
if in_file != out_file:
|||I can't install prorams on this machine. I use notepad++, which isn't bad - and doesn't need to be installed.|
Pythonutils Mailing List
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.
Ordered Dictionary - 0.2.0
After much experimentation I'm gingerly releasing odict 0.2.0.
This adds to the Ordered Dictionary :
- 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.
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.
pathutils and cgiutils
I've just done updates to pathutils and cgiutils.
These have extra code based on last weeks hacking.
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... ) 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.
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.
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.
Introdução Programacao Orientada Objetos
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.
This work is licensed under a Creative Commons Attribution-Share Alike 2.0 License.