<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Brian Lyttle &#187; python</title>
	<atom:link href="http://brianlyttle.com/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://brianlyttle.com</link>
	<description>What happens when the code just stops</description>
	<lastBuildDate>Wed, 16 May 2012 00:38:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>RedSnakePhilly 2012</title>
		<link>http://brianlyttle.com/2012/02/redsnakephilly/</link>
		<comments>http://brianlyttle.com/2012/02/redsnakephilly/#comments</comments>
		<pubDate>Sat, 25 Feb 2012 15:27:12 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Talks]]></category>
		<category><![CDATA[philadelphia]]></category>
		<category><![CDATA[photography]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://brianlyttle.com/?p=396</guid>
		<description><![CDATA[I was asked to take a few photos for this event by fellow pythonista Tom Panzarella. I think they turned out OK for the most part &#8211; although the EF 70-200 L IS II saved my arse in the end. It was difficult shooting with the lighting setup at the venue, but I&#8217;ll be back [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>I was asked to take <a href="http://www.flickr.com/photos/brianly/sets/72157629426130039/">a few photos</a> for this <a href="http://redsnakephilly.org/about/">event</a> by fellow pythonista <a href="https://twitter.com/#!/tpanzarella">Tom Panzarella</a>. I think they turned out OK for the most part &#8211; although the EF 70-200 L IS II saved my arse in the end. It was difficult shooting with the lighting setup at the venue, but I&#8217;ll be back there to get some more practice.</p>
<div id="slides">
  <img src="http://farm8.staticflickr.com/7070/6773517118_73536b5d98.jpg" alt="Beer Talk" /><br />
  <img src="http://farm8.staticflickr.com/7196/6919637765_5e9ee91319.jpg" alt="Hunter Blanks" /><br />
  <img src="http://farm8.staticflickr.com/7189/6773518210_c0038e5af9.jpg" alt="Redsnake Attendees" /><br />
  <img src="http://farm8.staticflickr.com/7181/6773521364_b10bb6fae4.jpg" alt="Dustin Getz" /><br />
  <img src="http://farm8.staticflickr.com/7053/6773520580_4d298315db.jpg" alt="Kyle Gorman" /><br />
  <img src="http://farm8.staticflickr.com/7062/6919634927_acdd8100da.jpg" alt="John Granieri" /><br />
  <img src="http://farm8.staticflickr.com/7202/6919635183_443c158d19.jpg" alt="Monetate" />
</div>
<p>All of the photos are <a href="http://www.flickr.com/photos/brianly/sets/72157629426130039/">over on Flickr</a> and they were even <a href="http://technicallyphilly.com/2012/02/24/10-presenters-bring-ruby-and-python-knowledge-to-second-annual-redsnake-philly-meetup-video">linked to</a> by Technically Philly!</p>
]]></content:encoded>
			<wfw:commentRss>http://brianlyttle.com/2012/02/redsnakephilly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python interpreter tab completion on OS X</title>
		<link>http://brianlyttle.com/2011/10/python-interpreter-tab-completion-on-os-x/</link>
		<comments>http://brianlyttle.com/2011/10/python-interpreter-tab-completion-on-os-x/#comments</comments>
		<pubDate>Sun, 09 Oct 2011 04:28:47 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://brianlyttle.com/?p=386</guid>
		<description><![CDATA[This is mainly for me own reference, but it is probably something that other people will find useful. If you attempt to use the rlcompleter module on the Mac you&#8217;ll find that tab completion does not work correctly. Apparently this is because Apple ship a neutered version of readline. To get completion working you have [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>This is mainly for me own reference, but it is probably something that other people will find useful. If you attempt to use the <a href="http://docs.python.org/library/rlcompleter.html">rlcompleter</a> module on the Mac you&#8217;ll find that tab completion does not work correctly. Apparently this is because Apple ship a neutered version of readline.</p>
<p>To get completion working you have to use a different argument to readline.parse_and_bind(). The base example uses:</p>
<pre>readline.parse_and_bind("tab: complete")</pre>
<p>Change that line to: </p>
<pre>readline.parse_and_bind ("bind ^I rl_complete")</pre>
]]></content:encoded>
			<wfw:commentRss>http://brianlyttle.com/2011/10/python-interpreter-tab-completion-on-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scrapy dependency problems with lxml</title>
		<link>http://brianlyttle.com/2011/09/scrapy-dependency-problems-with-lxml/</link>
		<comments>http://brianlyttle.com/2011/09/scrapy-dependency-problems-with-lxml/#comments</comments>
		<pubDate>Sun, 18 Sep 2011 19:31:17 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[lxml]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[scrapy]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://brianlyttle.com/?p=355</guid>
		<description><![CDATA[Following the recent PhillyPUG meetup I was trying to install scrapy on an old MacBook Pro running OS X 10.6 (Snow Leopard) and ran into a number of problems with the lxml dependency. This is the parser used to extract data from pages that scrapy downloads so you are not going to get very far [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Following the recent <a href="http://www.meetup.com/phillypug/events/31432902/">PhillyPUG</a> meetup I was trying to install <a href="http://scrapy.org/">scrapy</a> on an old MacBook Pro running OS X 10.6 (Snow Leopard) and ran into a  number of problems with the <a href="http://lxml.de/">lxml</a> dependency. This is the parser used to extract data from pages that scrapy downloads so you are not going to get very far without it.</p>
<p>It seems that the compilation problems experienced when installing with <em>pip</em> result from an attempt to build a universal binary. If you have Xcode 4 installed then you lose some of this capability and need to make sure that the correct architecture is specified.</p>
<h3>Architecture Fix</h3>
<p>Setting the architecture is something you can do in your bash profile, executing it under a new bash ensures that the build script picks it up.</p>
<pre>
sudo bash
export ARCHFLAGS='-arch i386 -arch x86_64'
pip install lxml # test it
pip install scrapy --upgrade # fix the failed scrapy install
</pre>
<h3>Original Error</h3>
<pre>
brianly$ sudo pip install lxml --upgrade
Downloading/unpacking lxml
  Downloading lxml-2.3.tar.gz (3.2Mb): 3.2Mb downloaded
  Running setup.py egg_info for package lxml
    Building lxml version 2.3.
    Building without Cython.
    Using build configuration of libxslt 1.1.24
    warning: no previously-included files found matching '*.py'
Installing collected packages: lxml
  Found existing installation: lxml 2.2.2
    Uninstalling lxml:
      Successfully uninstalled lxml
  Running setup.py install for lxml
    Building lxml version 2.3.
    Building without Cython.
    Using build configuration of libxslt 1.1.24
    building 'lxml.etree' extension
    gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -I/usr/include/libxml2 -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c src/lxml/lxml.etree.c -o build/temp.macosx-10.6-universal-2.6/src/lxml/lxml.etree.o -w -flat_namespace
    /usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed
    Installed assemblers are:
    /usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64
    /usr/bin/../libexec/gcc/darwin/i386/as for architecture i386
    src/lxml/lxml.etree.c:161594: fatal error: error writing to -: Broken pipe
    compilation terminated.
    lipo: can't open input file: /var/tmp//ccYr9GpX.out (No such file or directory)
    error: command 'gcc-4.2' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/Users/brianly/dev/github/pyconscrape/build/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-axeEA7-record/install-record.txt:
    Building lxml version 2.3.

Building without Cython.

Using build configuration of libxslt 1.1.24

running install

running build

running build_py

creating build

creating build/lib.macosx-10.6-universal-2.6

creating build/lib.macosx-10.6-universal-2.6/lxml

copying src/lxml/__init__.py -> build/lib.macosx-10.6-universal-2.6/lxml

copying src/lxml/_elementpath.py -> build/lib.macosx-10.6-universal-2.6/lxml

copying src/lxml/builder.py -> build/lib.macosx-10.6-universal-2.6/lxml

copying src/lxml/cssselect.py -> build/lib.macosx-10.6-universal-2.6/lxml

copying src/lxml/doctestcompare.py -> build/lib.macosx-10.6-universal-2.6/lxml

copying src/lxml/ElementInclude.py -> build/lib.macosx-10.6-universal-2.6/lxml

copying src/lxml/pyclasslookup.py -> build/lib.macosx-10.6-universal-2.6/lxml

copying src/lxml/sax.py -> build/lib.macosx-10.6-universal-2.6/lxml

copying src/lxml/usedoctest.py -> build/lib.macosx-10.6-universal-2.6/lxml

creating build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/__init__.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/_dictmixin.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/_diffcommand.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/_html5builder.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/_setmixin.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/builder.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/clean.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/defs.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/diff.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/ElementSoup.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/formfill.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/html5parser.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/soupparser.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/usedoctest.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

creating build/lib.macosx-10.6-universal-2.6/lxml/isoschematron

copying src/lxml/isoschematron/__init__.py -> build/lib.macosx-10.6-universal-2.6/lxml/isoschematron

creating build/lib.macosx-10.6-universal-2.6/lxml/isoschematron/resources

creating build/lib.macosx-10.6-universal-2.6/lxml/isoschematron/resources/rng

copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.macosx-10.6-universal-2.6/lxml/isoschematron/resources/rng

creating build/lib.macosx-10.6-universal-2.6/lxml/isoschematron/resources/xsl

copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.macosx-10.6-universal-2.6/lxml/isoschematron/resources/xsl

copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.macosx-10.6-universal-2.6/lxml/isoschematron/resources/xsl

creating build/lib.macosx-10.6-universal-2.6/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.macosx-10.6-universal-2.6/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.macosx-10.6-universal-2.6/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.macosx-10.6-universal-2.6/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.macosx-10.6-universal-2.6/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.macosx-10.6-universal-2.6/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.macosx-10.6-universal-2.6/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

running build_ext

building 'lxml.etree' extension

creating build/temp.macosx-10.6-universal-2.6

creating build/temp.macosx-10.6-universal-2.6/src

creating build/temp.macosx-10.6-universal-2.6/src/lxml

gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -I/usr/include/libxml2 -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c src/lxml/lxml.etree.c -o build/temp.macosx-10.6-universal-2.6/src/lxml/lxml.etree.o -w -flat_namespace

/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed

Installed assemblers are:

/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64

/usr/bin/../libexec/gcc/darwin/i386/as for architecture i386

src/lxml/lxml.etree.c:161594: fatal error: error writing to -: Broken pipe

compilation terminated.

lipo: can't open input file: /var/tmp//ccYr9GpX.out (No such file or directory)

error: command 'gcc-4.2' failed with exit status 1

----------------------------------------
  Rolling back uninstall of lxml
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.6/site-packages/pip-1.0.1-py2.6.egg/pip/basecommand.py", line 126, in main
    self.run(options, args)
  File "/Library/Python/2.6/site-packages/pip-1.0.1-py2.6.egg/pip/commands/install.py", line 228, in run
    requirement_set.install(install_options, global_options)
  File "/Library/Python/2.6/site-packages/pip-1.0.1-py2.6.egg/pip/req.py", line 1104, in install
    requirement.rollback_uninstall()
  File "/Library/Python/2.6/site-packages/pip-1.0.1-py2.6.egg/pip/req.py", line 487, in rollback_uninstall
    self.uninstalled.rollback()
  File "/Library/Python/2.6/site-packages/pip-1.0.1-py2.6.egg/pip/req.py", line 1417, in rollback
    pth.rollback()
AttributeError: 'str' object has no attribute 'rollback'

Storing complete log in /Users/brianly/.pip/pip.log
</pre>
]]></content:encoded>
			<wfw:commentRss>http://brianlyttle.com/2011/09/scrapy-dependency-problems-with-lxml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Python Imaging on Windows 64-bit (AMD64) Python</title>
		<link>http://brianlyttle.com/2011/03/installing-python-imaging-on-64bit-windows/</link>
		<comments>http://brianlyttle.com/2011/03/installing-python-imaging-on-64bit-windows/#comments</comments>
		<pubDate>Sat, 26 Mar 2011 19:31:49 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[imaging]]></category>
		<category><![CDATA[pil]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://brianlyttle.com/?p=309</guid>
		<description><![CDATA[If you want need a 64-bit version of this module for Google App Engine, or another project, you can run into a couple of issues. Sticking to 32-bit versions of Python and PIL avoids these issues so that may be the best direction for newbies. The downloads on the PIL site are for 32-bit versions [...]]]></description>
			<content:encoded><![CDATA[<p></p><p align="left">If you want need a 64-bit version of this module for <a href="http://code.google.com/appengine/">Google App Engine</a>, or another project, you can run into a couple of issues. Sticking to 32-bit versions of Python and PIL avoids these issues so that may be the best direction for newbies. </p>
<p>The <a href="http://www.pythonware.com/products/pil/">downloads on the PIL site</a> are for 32-bit versions of Python which means that you hit runtime issues as soon as the Python script files attempt to load the 32-bit libraries into 64-bit Python. Annoyingly the installer is unaware of the architecture for the Python installation it finds and will leave you with a broken PIL install. Just uninstall it from Control Panel. My first thought was to try an build from the sources but I figured someone has run into this problem.</p>
<p align="left">After some searching I <a href="http://www.lfd.uci.edu/~gohlke/pythonlibs/">found a site</a> which offers pre-built versions of many Python modules for 64-bit architectures including PIL. If you are in any way concerned about performance, or security a better solution might be to build from source or use versions from a company offering supported versions.</p>
<p align="left">I downloaded the version for Python 2.5 and then discovered that it would not install. What is interesting is that the 32-bit installer was able to find my 64-bit Python, but the 64-bit installer was unable to find it. </p>
<p>After some more searching it turns out that the installer takes it’s cue from a key in the registry and the Registry virtualization in Windows x64 was confusing it. To resolve the issue I had to export the “HKLM\SOFTWARE\Wow6432Node\Python\PythonCore\2.5” key, remove the “Wow6432Node\” string using a text editor, and re-import the key so that it was at “HKLM\SOFTWARE\Python\PythonCore\2.5”.</p>
<p>After doing this the 64-bit installer for PIL detected my Python installation and I was up and running. </p>
]]></content:encoded>
			<wfw:commentRss>http://brianlyttle.com/2011/03/installing-python-imaging-on-64bit-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Looking forward to PyCon 2010!</title>
		<link>http://brianlyttle.com/2010/02/looking-forward-to-pycon-2010/</link>
		<comments>http://brianlyttle.com/2010/02/looking-forward-to-pycon-2010/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 05:04:29 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[atlanta]]></category>
		<category><![CDATA[pycon]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://brianlyttle.com/?p=182</guid>
		<description><![CDATA[On Thursday I&#8217;m making the yearly pilgrimage to PyCon in Atlanta. This will be my third year and I&#8217;m sure it&#8217;ll be better than ever. For me the real highlights of this conference are the legendary open space sessions. The level of interaction and learning at these really sets it apart from other conferences. Last [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>On Thursday I&#8217;m making the yearly pilgrimage to <a href="http://us.pycon.org/2010/about/">PyCon in Atlanta</a>. This will be my third year and I&#8217;m sure it&#8217;ll be better than ever. </p>
<p>For me the real highlights of this conference are the legendary open space sessions. The level of interaction and learning at these really sets it apart from other conferences. Last year I attended a number of crackers including one on <a href="http://incubator.apache.org/cassandra/">Cassandra</a> and big data scalability with <a href="http://spyced.blogspot.com/">Jonathan Ellis</a>. It&#8217;s great to see that Jonathan is delivering a <a href="http://us.pycon.org/2010/conference/schedule/event/28/">scheduled talk on database scalability</a>, and I&#8217;m sure there will be a fair number of open space sessions dedicated to NoSQL databases.</p>
<p>Looking at the <a href="http://us.pycon.org/2010/conference/schedule/">2010 schedule</a> these are my other top picks:</p>
<ol>
<li><a href="http://us.pycon.org/2010/conference/schedule/event/19/">Deployment, development, packaging, and a little bit of the cloud</a> (Ian Bicking)</li>
<li><a href="http://us.pycon.org/2010/conference/schedule/event/47/">Powerful Pythonic Patterns</a> (Alex Martelli)</li>
<li><a href="http://us.pycon.org/2010/conference/schedule/event/76/">Understanding the Python GIL</a> (David Beazley)</li>
<li><a href="http://us.pycon.org/2010/conference/schedule/event/86/">Mastering Team Play: Four powerful examples of composing Python tools</a> (Raymond Hettinger)</li>
<li><a href="http://us.pycon.org/2010/conference/schedule/event/71/">Unladen Swallow: fewer coconuts, faster Python</a> (Collin Winter)</li>
</ol>
<p>I&#8217;ll have my camera with me again this year so watch out for pics under the pycon and pycon2010 tags on Flickr.</p>
]]></content:encoded>
			<wfw:commentRss>http://brianlyttle.com/2010/02/looking-forward-to-pycon-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter to blog script</title>
		<link>http://brianlyttle.com/2009/05/twitter-to-blog-script/</link>
		<comments>http://brianlyttle.com/2009/05/twitter-to-blog-script/#comments</comments>
		<pubDate>Sun, 24 May 2009 17:37:58 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://brianlyttle.com/?p=147</guid>
		<description><![CDATA[Based on an example provided with the Twitter library for Python I cobbled together the following script to add my latest tweets to this site. It&#8217;s called from a cron job that I run on an occasional basis. My script linkifies hashtags and @username tokens in tweets so that you can see search results or [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><img src="/wp-content/uploads/2009/05/twitter_logo_header.png" alt="Twitter logo" class="imgright" />Based on <a href="http://code.google.com/p/python-twitter/source/browse/trunk/examples/twitter-to-xhtml.py">an example</a> provided with the <a href="http://code.google.com/p/python-twitter/">Twitter library for Python</a> I cobbled together the following script to add my latest tweets to this site. It&#8217;s called from a cron job that I run on an occasional basis. My script linkifies hashtags and @username tokens in tweets so that you can see search results or user information.</p>
<p>Why did I not use one of the WordPress widgets? Well writing scripts like this is fun, and some widgets don&#8217;t seem to play too well with my Thesis theme. One thing to note is that getting the shell script setup under some cron configurations can take a while if you aren&#8217;t using it on a regular basis. It&#8217;s operation is also different between Ubuntu Server and Joyent&#8217;s Accelerator platform.</p>
<p>Up next: a similar script to process my latest bookmarks on <a href="http://delicious.com/brianly">Delicious.com</a>.</p>
<p><strong>Main script (tweets.py)</strong></p>
<pre>
#!/usr/bin/python

import codecs, re, getopt, sys, twitter

TEMPLATE = &quot;&quot;&quot;
&lt;li&gt;
  &lt;span class=&quot;twitter-text&quot;&gt;%s&lt;/span&gt;
  &lt;span class=&quot;twitter-relative-created-at&quot;&gt;&lt;a href=&quot;http://twitter.com/%s/statuses/%s&quot;&gt;Posted %s&lt;/a&gt;&lt;/span&gt;
&lt;/li&gt;
&quot;&quot;&quot;

def Usage():
  print 'Usage: %s [options] twitterid' % __file__
  print
  print '  This script fetches a users latest twitter update and stores'
  print '  the result in a file as an XHTML fragment'
  print
  print '  Options:'
  print '    --help -h : print this help'
  print '    --output : the output file [default: stdout]'

def FetchTwitter(user, output):
  assert user
  statuses = twitter.Api().GetUserTimeline(user=user, count=7)

  xhtml = []
  for status in statuses:
  	  status.text = Linkify(status.text)
  	  xhtml.append(TEMPLATE % (status.text, status.user.screen_name, status.id, status.relative_created_at))

  if output:
    Save(''.join(xhtml), output)
  else:
    print ''.join(xhtml)

def Linkify(tweet):
    tweet = re.sub(r'(\A|\s)@(\w+)', r'\1@<a href="http://www.twitter.com/\2">\2</a>', tweet)
    return re.sub(r'(\A|\s)#(\w+)', r'\1#<a href="http://search.twitter.com/search?q=%23\2">\2</a>', tweet)

def Save(xhtml, output):
  out = codecs.open(output, mode='w', encoding='utf-8',
                    errors='xmlcharrefreplace')
  out.write(xhtml)
  out.close()

def main():
  try:
    opts, args = getopt.gnu_getopt(sys.argv[1:], 'ho', ['help', 'output='])
  except getopt.GetoptError:
    Usage()
    sys.exit(2)
  try:
    user = args[0]
  except:
    Usage()
    sys.exit(2)
  output = None
  for o, a in opts:
    if o in ("-h", "--help"):
      Usage()
      sys.exit(2)
    if o in ("-o", "--output"):
      output = a
  FetchTwitter(user, output)

if __name__ == "__main__":
  main()
</pre>
<p><strong>Shell script executed as cron job (tweets.sh)</strong></p>
<pre>
/usr/bin/python /path/to/tweets.py brianly --output /path/to/output/twittertimeline.htm
</pre>
]]></content:encoded>
			<wfw:commentRss>http://brianlyttle.com/2009/05/twitter-to-blog-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Weekly Links #2</title>
		<link>http://brianlyttle.com/2009/01/weekly-links-2/</link>
		<comments>http://brianlyttle.com/2009/01/weekly-links-2/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 04:18:12 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Bookmarks]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[retlang]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[wpf]]></category>

		<guid isPermaLink="false">http://brianlyttle.com/?p=66</guid>
		<description><![CDATA[Microsoft InfoMesa Project Whiteboard for your data Fabric &#8211; like Capistrano but written in Python A Visual Introduction to Screen retlang &#8211; Google Code Tim Sneath : The Bumper List of Windows 7 Secrets update-engine &#8211; Google Code]]></description>
			<content:encoded><![CDATA[<p></p><ul>
<li><a href="http://blogs.msdn.com/dan_fay/archive/2008/12/09/infomesa-project-whiteboard-for-your-data.aspx">Microsoft InfoMesa Project Whiteboard for your data</a></li>
<li><a href="http://www.nongnu.org/fab/">Fabric &#8211; like Capistrano but written in Python</a></li>
<li><a href="http://blogamundo.net/code/screen/">A Visual Introduction to Screen</a></li>
<li><a href="http://code.google.com/p/retlang/">retlang &#8211; Google Code</a></li>
<li><a href="http://blogs.msdn.com/tims/archive/2009/01/12/the-bumper-list-of-windows-7-secrets.aspx">Tim Sneath : The Bumper List of Windows 7 Secrets</a></li>
<li><a href="http://code.google.com/p/update-engine/">update-engine &#8211; Google Code</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://brianlyttle.com/2009/01/weekly-links-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IronPython 2.0 released</title>
		<link>http://brianlyttle.com/2008/12/ironpython-2-0-released/</link>
		<comments>http://brianlyttle.com/2008/12/ironpython-2-0-released/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 03:32:28 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[ironpython]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://brianlyttle.com/?p=277</guid>
		<description><![CDATA[Congratulations to Dino, Harry, and the rest of the IronPython team! They just released IronPython 2.0 which has parity with CPython 2.5. This release of IronPython includes release 0.9 of the Dynamic Language Runtime (DLR). Download it from CodePlex.]]></description>
			<content:encoded><![CDATA[<p></p><p>Congratulations to <a href="http://blogs.msdn.com/dinoviehland/">Dino</a>, <a href="http://www.devhawk.net">Harry</a>, and the rest of the <a href="http://www.codeplex.com/IronPython">IronPython</a> team! They just released IronPython 2.0 which has parity with CPython 2.5. This release of IronPython includes release 0.9 of the <a href="http://www.codeplex.com/dlr">Dynamic Language Runtime (DLR)</a>.</p>
<p>Download it from <a href="http://www.codeplex.com/IronPython/Release/ProjectReleases.aspx?ReleaseId=8365">CodePlex</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://brianlyttle.com/2008/12/ironpython-2-0-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PyCon 2008 &#8211; IronPython Highlights</title>
		<link>http://brianlyttle.com/2008/03/pycon-2008-ironpython-highlights/</link>
		<comments>http://brianlyttle.com/2008/03/pycon-2008-ironpython-highlights/#comments</comments>
		<pubDate>Tue, 18 Mar 2008 02:42:28 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Talks]]></category>
		<category><![CDATA[ironpython]]></category>
		<category><![CDATA[pycon]]></category>
		<category><![CDATA[pycon2008]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://brianlyttle.com/?p=273</guid>
		<description><![CDATA[IronPython was one of the factors that impacted my decision to attend PyCon. Microsoft are approaching the release of version 2.0 which will have parity with CPython 2.5. The production versions already are close to full Python 2.4 support making it a viable platform for use in a lot of places where I would typically [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><a href="http://www.codeplex.com/IronPython">IronPython</a> was one of the factors that impacted my decision to attend PyCon. Microsoft are approaching the release of version 2.0 which will have parity with CPython 2.5. The production versions already are close to full Python 2.4 support making it a viable platform for use in a lot of places where I would typically use C#.</p>
<p><img style="float: right; margin-top: 5px;" src="/images/openspace-python.net.jpg" alt="Open space session" />Going into the conference I was looking forward to the Sunday session with Jim Hugunin but there turned out to be some more treats for the IronPython developer. <a href="http://feihonghsu.blogspot.com/">Feihong Hsu</a> ran a session on Python.NET and how you can bridge from CPython to the .NET platform, taking advantage of rich Windows APIs. <a href="http://www.voidspace.org.uk/">Michael Foord</a> spoke on Silverlight as well as <a href="http://www.resolversystems.com/">his company&#8217;s spreadsheet</a> which embeds IronPython.</p>
<p>Feihong organised an open space session for Saturday evening after the PyWin32 gathering to talk about Python.NET and we were joined by the IronPython developers and management (<a href="http://blogs.msdn.com/dinoviehland/">Dino Viehland</a>, <a href="http://www.devhawk.net/">Harry Pierson</a>, <a href="http://blogs.msdn.com/hugunin/">Jim Hugunin</a> and others). We discussed a number of aspects of IronPython and progress towards the 2.0 release. It looks like this may be complete in October given that they released the first beta last week. Again Michael Foord had something interesting to say on what Resolver Systems are doing.</p>
<p><img style="float: left; margin-top: 5px; margin-right: 5px;" src="/images/ironclad.jpg" alt="Michael Foord presents IronClad" />Michael presented an open source project called <a href="http://code.google.com/p/ironclad/">IronClad</a>. This is quite an insane assortment of code from C# to Python to assembler all in the name of accessing Python modules written in C. To date they have the bzip2 module running but are working on support for modules like NumPy which are important to their customers.</p>
<p>After the open space session we headed into Chicago for dinner at <a href="http://chicago.citysearch.com/profile/39551968/chicago_il/india_house.html">India House</a>. This gave us a chance to find out some more stuff about the IronPython implementation, and other factoids. Dino hinted that he was working on getting Django up and running. Little did we know he was going to be demoing this to the crowd on Sunday.</p>
<p><img style="float: right; margin-top: 5px;" src="/images/hugunin.jpg" alt="Jim Hugunin and Dino Viehland" />Sunday saw Jim&#8217;s big talk and I managed to get a few photos. It wasn&#8217;t easy, but I think these turned out a bit better than earlier shots at the conference. Dino showed off the fairly minimal changes needed to get Django running on IronPython and Jim demoed the IronPython interpreter running under Dynamic Silverlight.</p>
<p>After the keynote, Dino gave a me a quick run through of the IronPython and DLR source code. This was very interesting and it gave me a real step up in understanding what goes on under the covers. Thanks Dino!</p>
]]></content:encoded>
			<wfw:commentRss>http://brianlyttle.com/2008/03/pycon-2008-ironpython-highlights/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PyCon 2008 &#8211; Day Zero</title>
		<link>http://brianlyttle.com/2008/03/pycon-2008-day-zero/</link>
		<comments>http://brianlyttle.com/2008/03/pycon-2008-day-zero/#comments</comments>
		<pubDate>Fri, 14 Mar 2008 00:41:04 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Talks]]></category>
		<category><![CDATA[pycon]]></category>
		<category><![CDATA[pycon2008]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://brianlyttle.com/?p=271</guid>
		<description><![CDATA[Today was the Python tutorial day. Given that I haven&#8217;t spent a lot of time reading or writing Python code I thought it would be a good idea to attend some of these tutorials. Since they kicked off at 9am it was a bit of a challenge making it on time. My Southwest flight from [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Today was the Python tutorial day. Given that I haven&#8217;t spent a lot of time reading or writing Python code I thought it would be a good idea to attend some of these tutorials. Since they kicked off at 9am it was a bit of a challenge making it on time. My Southwest flight from Philly last night arrived late, and then I had a big trip around to the other side of Chicago. If you need to attend a conference near O&#8217;Hare, try to fly into that airport. All I wanted to do was to lie in bed for a few more hours <img src='http://brianlyttle.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>When I made my tutorial selections I was hoping to attend a Python for Java Developers session. This would have been useful given my experience with C# but it seems that I was in the minority and it was cancelled. I switched to the Django session but I think I may have been better attending the session on performance optimisation.</p>
<p>Registration wasn&#8217;t too busy today since the main conference crew won&#8217;t arrive till Friday. I got a PyCon bag and some flyers but the T-Shirts weren&#8217;t ready. Apparently they&#8217;ll be available tomorrow, I&#8217;d hate to miss out on one!</p>
<p><strong>Python 101 Tutorial (Steve Holden)</strong></p>
<p>It turns out that Steve was another British ex-pat living here in the US. It gets weirder in that he lectured at Manchester University for a number of years. Given Steve&#8217;s position in the community I expected a sharp introduction to Python. It didn&#8217;t disappoint and I picked up a fair bit. The &#8216;slice&#8217; mechanism looks really useful, I wonder if it can be implemented with any of the new C# features?</p>
<p><strong>Getting Started with Django (Jacob Kaplan-Moss)</strong></p>
<p>I was expecting this session to be a little more exciting. Jacob has some fine ideas about how Python frameworks should be built but his presentation style is not as striking as DHH. Since this was an introductory session I can&#8217;t complain too much but I really want to hear some more about Django deployment and debugging over the next few days.</p>
<p><strong>Internet Programming with Python (Wesley Chun)</strong></p>
<p>At this point I was pretty exhausted. This tutorial seemed to be geared toward newbies to network programming, rather than a best practice session on leveraging Python for internet programming.</p>
]]></content:encoded>
			<wfw:commentRss>http://brianlyttle.com/2008/03/pycon-2008-day-zero/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

