Python Python: testing beyond exceptions Recently working on some code I was doing some basic tests that checked for an exception being raised. The tests looked like this: def test_user_identification_is_valid_option(self): with self.assertRaises(ValueError): example_seller(products=[ 'id': 'hai', 'description': 'a description&
OSX OSX: Fixing Python + Virtualbox after upgrading to Mavericks {<1>} I've just done the upgrade to Mavericks on my work machine. All went pretty well but there were a couple of hitches. Both Python and Virtualbox had some issues. Fixing Python Fortunately my dev env are all safely tucked away inside an Ubuntu VM however
Python Linux: Spotify Track Notifier with added D-Bus love I've recently updated the spotify notifier example I'd previously posted as an example along with my spotify screensaver script [https://muffinresearch.co.uk/archives/2010/11/03/spotify-screensaver-toggle-with-dbus/]. First, I made an update to have it listen to the PropertiesChanged signal. Annoyingly for some unknown reason
Python Fake SMTP server with Python The other day a colleague was testing some code which relied on sending mail to a local mailserver and it was failing when the mailserver couldn't be found. Needing to install postfix seemed overkill so I decided to look into what could be done to make a fake
Python Spotify: Linking to a specific time in a track For a while I've wanted to be able to share a link to a track on spotify so that it jumps the right place. An example is when learning covers for the band I play in; or just to point out a great part of the track. The
Python Cross Platform Keyring Library for Python Kang Zhang [http://kangzhang.org/] has been busy on a Google Summer of Code project to create a cross platform keychain library for Python. > The Python keyring lib provides a easy way to access the system keyring service from python. It can be used in any application that needs
Python Simple Switching of VirtualEnv Environments If you're using Python for any kind of serious development virtualenv is highly recommended as a way to sandbox dependencies and allow you to run different libraries and or python versions for different projects. For more on Virtualenv and how to use it see VirutalEnv on PyPi [http:
Python Fixing setuptools "TypeError: swig_sources()" error I was trying to update to a newer version of Jinja2 on osx to meet Zine dependencies and I got the following error: Traceback (most recent call last): […snip…] File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/setuptools/command/build_ext.py", line 77,
Python Install lxml on OSX Thanks to this post on lxml from Ian Bicking [http://blog.ianbicking.org/2008/12/10/lxml-an-underappreciated-web-scraping-library/] I've found the following command is all that's required to install lxml on Mac OSX: STATIC_DEPS=true easy_install 'lxml>=2.2beta4'
Python Python 3.0 Released So Python 3.0 is out [http://www.python.org/download/releases/3.0/] - here's the list of what's new [http://docs.python.org/3.0/whatsnew/3.0.html]. There's a lot in there and it specifically say it's incomplete
Python FAIL of the week: uTidyLib unicode error This week I’ve been having fun using uTidyLib, a python wrapper for HTML tidy. All was working swimmingly until I hooked it up to a custom form validation function in Django. The Python process on my mac kept crashing and I was wondering what the cause was since it
Python Titlecase.py: Titlecase in python John Gruber recently published a perl script to convert strings into title case [http://daringfireball.net/2008/05/title_case] avoiding capitalizing small words based on rules from the New York Times Manual of style as well as catering for several special cases. Before porting the perl script I tried
Python Python: Debugging with PDB Debugging anything can be a real pain in the backside. However with the right tools (think firebug) it actually can become enjoyable. The other day Rob [http://www.siudesign.co.uk/], showed me the pdb module [http://docs.python.org/lib/module-pdb.html] and after using it for two secs
Python pwdn: show last n dirs of current directory I've been playing around with some scripts of late to automate delivery of my various scripts and aliases to servers and in doing so I was looking back at the code I am calling to display the last two directories in my bash prompt [https://muffinresearch.co.uk/
Python Python or PHP? Recently I've been having interesting discussions with Ed [http://ejeliot.com] and Cyril [http://cyril.doussin.name/thoughts/] regarding some of the differences between PHP and Python and what makes each one special. So I'm interested to know what are the things you love about PHP
Code Python: Transposing Lists With map and zip I'm re-writing a piece of code to print into columns within a terminal and I wanted to join the nth items of each list together. Zip allows you to do just that >>> my_list=[[1,2,3],[4,5,6],[7,8,9,10]] >