Workflow for debugging issues on python on windows with a VM

Thu 12 March 2015
By stu

Recently I had to look at an issue where the behaviour on windows was subtly different to that on linux... unfortunately most potential users are on Windows so it's not good enough to just write them off :)

This workflow was quite good for checking python internals on different versions of python and being able to revert things easily.

To get things going quickly I use the IE11 VM from microsoft, and download from xdissent

https://github.com/xdissent/ievms

That way you just need to enter a command to download it

{: .brush:bash} curl -s https://raw.githubusercontent.com/xdissent/ievms/master/ievms.sh | env IEVMS_VERSIONS="11" bash

Next I install all the tools I need before python (we will save the state of the VM before then).

chocolatey.org makes installing tools easy*

https://chocolatey.org/

Open a command Window as Administrator then install chocolatey:

{: .brush:bash} @powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

Once thats done you can install tools you need - I install everything *except* python:

choco install git conemu

While these are installing start the downloads for python and it's C compiler (remember not to install them yet):

Grab python from here:

https://www.python.org/downloads/

For python 2.7.x you will probably need the VC compiler

http://www.microsoft.com/en-gb/download/details.aspx?id=44266

My app was for PyGtk so I also downloaded that - download anything else you need at this stage.

Download your project...

Using git or whatever, grab your own project to a directory.

Save the VM state.

In virtualbox save the machine state, I called mine 'Tools Installed'.

From here you can install python + know that you can poke around in the internals, any time you want to check against a different version, just revert the VM to the previous state.

TL;DR - Install all tools except python, grab projects, SNAPSHOT, install python - find bugs.

*when it works.