Evil geniuses and world domination are 2 of our goals... we also like Dr Who

Python, Python packaging and why I still dislike macs

no comment

Python Logo

I have been developing a little application in python.

“oooh!” I hear you cry, “Get you using free and open source development languages to develop a cross platform application. Was it a liberating, life changing experience?”

Well yes. Yes it was. And no as well

Here’s the yes, the pros of development. The plan was to develop a small application to run on the Mac Mini we use here in the bunker as a DVD player.  Having spent some time reading up on Cocoa and straining my eyes trying to read the display ( its connected to the TV via a scart composite cable so the desktop display isn’t great)  I decided to develop the application on my Windows Desktop using python. The rational being that it is cross platform, if I can write it to work in a windows environment, it should work in a Mac environment right?

I installed a portable python and Boa constructor onto my trusty USB Key based development studio ( more on this another time) and in an afternoon I had managed to write my first ever python WX app !

booting up the Linux laptop I installed python and wx in a short period of time (Ubuntu software centre is the gift that keeps on giving! ) and yup, the application ran fine

So far,  so good, I have developed in one platform and deployed to another. now the next step. compile it into a stand alone exe that can run in Mac OS. And this is where we come to the cons

Mac Software centre

Mac OS has a software centre for getting software.  I wanted to be certain that I had the latest version of python. so I typed it in the search field. After sifting through downloads of Monty Python’s flying circus shows and films I found it. all for the princely sum of £1.99

really? £1.99 for software that’s free and easily download-able from pythons own website after a cursory search on google? Why anyone would think that Apple where a money grubbing organisation trying to fleece owners by charging for free content?

Installing WX

next up was installing wx. A relatively painless experience. The was an installer on their website that allowed the installation of the package and I was finally able to test the application in the Mac OS and it worked! Kind of.  Because of font differences. one of the buttons needed to be enlarged and moved – cue 20 minutes of putting values in, running the module , stopping the module, changing values etc just to more-or-less replicate what showed up first time on windows and Linux.

Installing py2app

In order to convert the python script into a stand alone app  was going to use py2app which makes creating app files easy. This is the point where I lost the best part of a day struggling with  a number of issues, chief among them is the fact that as a Windows/Linux user I am used to right clicking a link in my web browser and saving links. to right click on mac you hold down ctr (yeah its so intuitive to me too) Apparently Mighty mouse which are 4 button mice do actually have a right click functionality,  but it needs to be set up from the finder by assigning the secondary click function to the right button- don’t panic, its not as scary as it sounds, but you got to question why such simple design paradigms have to be defined. When i plug a new mouse into my windows or Linux box, I don’t have then tell the OS what buttons do what It works out of the box.

installing easyinstall

To install Py2app I was going to have to install another python package called easyinstall. This is the point where I lost a lot of time on the documentation. which , while it showed me what to type in terms of setting it up. I was typing the commands into a python shell window and trying to run it as a python module with no luck until Mike told me that it was terminal prompts. Just a  line explaining that this was to be run from a terminal would have saved me 4 hours of frustration trying to get easy install er… installed

installing app2exe (again)

However, once I had installed easy install, installing py2app was a dream.  its a lot easier to use terminal commands when you actually know they are terminal commands!

making the application

I then started setting up the solution to create the app. Py2app basically takes a number of arguments, the first is the location of the main.py file, followed by resources. in this case the application icon. The problem here was my USB Key. On Mac OS it appears with the title “NO NAME” and while py2app could parse the space in the location of the initial .py file, apparently for the icon file it didn’t recognise it. Cue renaming of drive to replace spaces with underscores

This time I wan the py2app applet and SUCCESS!!!! a program appeared in my Release folder in my user profile. After 2 evenings of frustration, weeping and much gnashing of teeth, I had built my first Python  Mac OS application!

Lets run it to see how it works.

And it crashed. Something to do with different versions of WX!!!! AGGGGGGGHHHHH!!!!


ho hum back to the drawing board.



Everyone has one novel in them… Or should that be Navel?

no comment

There’s a saying that everyone has a novel in them, and some months ago I set about trying to liberate mine.  I won’t bore you with the details  – wait for the movie 😉 but the most interesting part of the whole exercise for me was based around setting up the infrastructure to support the author.

I use Linux, and was looking for a Novel Authoring tool.  There is the venerable YWriter – a free tool from Spacejock software, which I tried, but never really got it to work correctly under Linux.  So I looked for an alternative, and I think I’ve found one – Storybook

Storybook provides an interface by wich the author can track the various narative strands within the story, the characters, the assets and the timeline.  Reasearch photos can be stored and the whole thing is stored in an easy to manage format.

The biggest issue with StoryBook is that it isn’t packaged for Linux, which can make the installation of it somewhat difficult.  Don’t get me wrong – it’s a Java application, and therefore it is easy enough to install – simply decrypt to a folder, but it raises more interesting questions about how we ensure consistency between StoryBook and other Java Applications  – such as JOSM.

I’m planning a later article on packgaing Java applications for Ubuntu, but in the short trem I’ll document the technique I used to install it, and syncronise it between different machines

Installing StoryBook under Ubuntu

?Browse to the StoryBook Site –

Download the Linux version.

To install the requirements run the following

sudo apt-get update

sudo apt-get install openjdk-6-jre

cd to the directory

and execute the command : ./storybook.sh

sit back and bask in the glory that is StoryBook…