simonb.com: blog > articles tagged with python

skip to content
You are here: 

Articles in blog tagged with python

Wednesday, 23 February 2011

Mac No Suitable Image Found

If you're building native extensions for python or ruby on a Mac and you get an error like:

no suitable image found

It probably means the language and extension were compiled for different architectures, i.e. 32-bit vs 64-bit or i386 vs x86_64. I use fink on the Mac and it defaults to compiling 32-bit versions. You can tell fink to default to 64-bit when you do an initial install from source but it's not as well tested as 32-bit and 32-bit works fine so why bother? However, 10.6, left to its own devices, will compile code to 64-bit versions. So…

read more

Tags: 

     

Tuesday, 22 December 2009

Debugging utf-8 Email In Django And Python

In case anyone else is wondering why their utf-8 email is not coming out as it should when using Django...

Non-ascii character sets are a major pain when writing code to send email. They're not impossible by a long way but they do take some digging to figure out why your nicely formated utf-8 Chinese is coming out in garbled characters, tracing code, examing email headers... Oh the joy. So it does not help when your framework of choice (Django) decides it knows that you really want a certain type of text encoding, even if you are writing your own…

read more

Tags: 

   

Friday, 4 September 2009

Gentoo Not Upgrading To Python 2.6

Gentoo recently switched to make python 2.6 the default python. This means that mod_python and mod_wsgi will be re-compiled against 2.6. Which means that any python modules you're using with Apache will also need to be re-compiled against the new version or you'll get version mis-match errors. If you'd rather not go through all that work you can tell portage not to upgrade with the following line in /etc/portage/package.mask:

> python-2.6

That says mask Python versions greater than 2.6. OK back to work.

read more

Tags: 

   

Tuesday, 11 December 2007

Google Chart API

Google have released their chart API. Here’s a few alternatives for Python:

See also vtk and MayaVi

read more

Tags: 

   

Wednesday, 17 January 2007

urllib2.URLError: urlopen error unknown url type: https

Note to self: for the following to work on a Mac with fink’s python

xml = urllib2.urlopen("https://api.del.icio.us/v1/posts/recent").read()

Your python needs ssl support.

fink install python24-socket-ssl

Phew!

read more

Tags: