Skip to main content

Posts

Showing posts from June, 2011

Dear HP & Microsoft - you're doing it wrong

So I got a new computer last week, of course after a day or so decided that I might want to do some work on it in which case I'd would prefer to have Ubuntu installed. I've never had too much trouble setting up a dual boot systems in the past; notable setups I've had include Gentoo/OSX, Ubuntu/XP and Ubuntu/Mint/XP/7.

So I got a brand new HP Pavilion with Windows 7 Home Premium pre-installed. It was nicely set up, had pretty much the latest drivers and if I was just wanting to live in a Windows 7 box things would have been sweet. I realize that most people fit in this category, but still not impressed with what follows. As laptops tend to these days the machine didn't come with any optical media for drivers or operating systems, instead there was a recovery partition taking up a 25GB hidden partition of my hard drive. This is fine. Perhaps an option to burn an installer DVD when you first turn it on would be a good option though.

I booted from a Ubuntu live USB and res…

Porting labjack's Python 2 library to Python 3

I'm teaching an introduction to programming with Python 3 at work, 12 weeks with a 2 hour seminar once a week and homework. Internally one of the biggest uses of Python is in hardware interaction - especially when it comes to automated testing. We communicate with embedded devices running elua, labjacks, programmable power supplies, oscilloscopes, Kvaisers and more with Python - primarily using the serial interface and abstracting the hardware with Python.

Since most of our existing code uses python2, I figured I should spend an hour looking at porting an existing Python module to python3. The python library we currently use to communicate with Labjack is an in house ctypes wrapper, but Labjack have their own Python library code so I decided to port that to Python3.

I only did the bare minimum to get the basic tutorial running but you can see forked code on github. For the most part 2to3 did everything. The modifications I had to make were all because the Labjack operates at a pre…