<?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>Chui's counterpoint &#187; Python</title>
	<atom:link href="http://www.redmountainsw.com/wordpress/archives/tag/python/feed" rel="self" type="application/rss+xml" />
	<link>http://www.redmountainsw.com/wordpress</link>
	<description>pulling the rug</description>
	<lastBuildDate>Fri, 19 Mar 2010 03:35:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Printing the current running stack in Python</title>
		<link>http://www.redmountainsw.com/wordpress/archives/printing-the-current-running-stack-in-python</link>
		<comments>http://www.redmountainsw.com/wordpress/archives/printing-the-current-running-stack-in-python#comments</comments>
		<pubDate>Thu, 23 Jul 2009 23:30:37 +0000</pubDate>
		<dc:creator>Chui</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.redmountainsw.com/wordpress/archives/printing-the-current-running-stack-in-python</guid>
		<description><![CDATA[The traceback module has utility functions for printing the currently running stack, not just tracebacks.

import traceback
import logging

# somewhere in your buggy code
logging.log(1, &#34;&#34;.join(traceback.format_stack())

]]></description>
			<content:encoded><![CDATA[<p>The traceback module has utility functions for printing the currently running stack, not just tracebacks.</p>
<pre class="brush: python">
import traceback
import logging

# somewhere in your buggy code
logging.log(1, &quot;&quot;.join(traceback.format_stack())
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.redmountainsw.com/wordpress/archives/printing-the-current-running-stack-in-python/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>unable to remap C:\cygwin\bin\tk84.dll to same address as parent</title>
		<link>http://www.redmountainsw.com/wordpress/archives/unable-to-remap-ccygwinbintk84dll-to-same-address-as-parent</link>
		<comments>http://www.redmountainsw.com/wordpress/archives/unable-to-remap-ccygwinbintk84dll-to-same-address-as-parent#comments</comments>
		<pubDate>Sat, 25 Apr 2009 11:00:33 +0000</pubDate>
		<dc:creator>Chui</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[PIL]]></category>

		<guid isPermaLink="false">http://www.redmountainsw.com/wordpress/archives/unable-to-remap-ccygwinbintk84dll-to-same-address-as-parent</guid>
		<description><![CDATA[I was checking out Tauber&#8217;s Pinax, and came across VirtualEnv for the first time. Those are two cool projects. 
However, building PIL on Cygwin Python 2.5 yields the following error message:
unable to remap C:\cygwin\bin\tk84.dll to same address as parent
Thanks to the power of Google, DataHammer has already found a resolution


C:\>cd \cygwin\bin
C:\cygwin\bin>ash
$ ./rebase -b 0x1000000000 tk84.dll

]]></description>
			<content:encoded><![CDATA[<p>I was checking out Tauber&#8217;s Pinax, and came across VirtualEnv for the first time. Those are two cool projects. </p>
<p>However, building PIL on Cygwin Python 2.5 yields the following error message:</p>
<pre>unable to remap C:\cygwin\bin\tk84.dll to same address as parent</pre>
<p>Thanks to the power of Google, <a href="http://blog.datahammer.info">DataHammer</a> has already found <a href="http://blog.datahammer.info/2008/11/install-pil-under-cygwin-python-25.html">a resolution</a><br />
<code>
<pre>
C:\>cd \cygwin\bin
C:\cygwin\bin>ash
$ ./rebase -b 0x1000000000 tk84.dll
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.redmountainsw.com/wordpress/archives/unable-to-remap-ccygwinbintk84dll-to-same-address-as-parent/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python Grep</title>
		<link>http://www.redmountainsw.com/wordpress/archives/python-grep</link>
		<comments>http://www.redmountainsw.com/wordpress/archives/python-grep#comments</comments>
		<pubDate>Wed, 28 Jan 2009 04:46:12 +0000</pubDate>
		<dc:creator>Chui</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.redmountainsw.com/wordpress/?p=632</guid>
		<description><![CDATA[From ZazzyBob
Occasionally I have to wade through log files on sites running Windows, since our program is python based, it&#8217;s useful to be able to have these tools on hand without downloading exes. I&#8217;m hosting a copy here just in case it gets lost in the interweb.

#!/usr/bin/python
#&#60; PYTHON - simple grep through a file - [...]]]></description>
			<content:encoded><![CDATA[<p>From <a href="http://www.zazzybob.com/bin/grep.py.html">ZazzyBob</a></p>
<p>Occasionally I have to wade through log files on sites running Windows, since our program is python based, it&#8217;s useful to be able to have these tools on hand without downloading exes. I&#8217;m hosting a copy here just in case it gets lost in the interweb.</p>
<pre class="brush: python">
#!/usr/bin/python
#&lt; PYTHON - simple grep through a file - supports regex
# Usage: grep.py &quot;pattern&quot; file
# Written to test my fledgling python knowledge!

import sys
import re
arguments = sys.argv

def print_usage():
    print &quot;USAGE:&quot;
    print &quot;grep.py \&quot;pattern\&quot; filename&quot;

if len(arguments) != 3:
    print_usage()
    sys.exit(1)

searchterm = arguments[1]
file = arguments[2]

print &quot;Searching for %s in %s&quot; % ( searchterm, file )

try:
  fileToSearch = open( file, &#039;r&#039; )
except IOError:
  print &quot;No such file&quot;
  sys.exit(2)

# Well, we&#039;ve got this far - the file must exist!
data = fileToSearch.read()
data = data.split(&#039;\n&#039;)

patternprog = re.compile( searchterm )

for line in data:
  a_match = patternprog.search( line )
  if ( a_match ):
     print line

fileToSearch.close()
sys.exit( 0 )
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.redmountainsw.com/wordpress/archives/python-grep/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cygwin Python and sqlite3</title>
		<link>http://www.redmountainsw.com/wordpress/archives/cygwin-python-and-sqlite3</link>
		<comments>http://www.redmountainsw.com/wordpress/archives/cygwin-python-and-sqlite3#comments</comments>
		<pubDate>Mon, 08 Sep 2008 01:57:33 +0000</pubDate>
		<dc:creator>Chui</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[cygwin]]></category>
		<category><![CDATA[sqlite3]]></category>

		<guid isPermaLink="false">http://www.redmountainsw.com/wordpress/?p=479</guid>
		<description><![CDATA[Apparently, cygwin&#8217;s distribution of Python 2.5.1 doesn&#8217;t come with sqlite3. This is a pity for those who would like to work with Django using cygwin Python.
Building _sqlite3.dll on cygwin is not too difficult. If you are in a hurry, heres the download _sqlite3.dll.
Prerequisites

/bin/cygsqlite3-0.dll
/bin/libpython2.5.dll
/usr/include/sqlite3.h
/usr/include/python2.5/Python.h [et.c]



tar jxf Python-2.5.2.tar.bz2 Python-2.5.2/Modules/_sqlite/
cd Python-2.5.2/Modules/_sqlite/
gcc -shared -o _sqlite3.dll -I /usr/include/python2.5 -L /bin [...]]]></description>
			<content:encoded><![CDATA[<p>Apparently, <a href="http://www.mail-archive.com/cygwin@cygwin.com/msg83812.html">cygwin&#8217;s distribution of Python 2.5.1 doesn&#8217;t come with sqlite3</a>. This is a pity for those who would like to work with Django using cygwin Python.</p>
<p>Building _sqlite3.dll on cygwin is not too difficult. If you are in a hurry, heres the <b>download</b> <a href="/wordpress/wp-content/uploads/_sqlite3.dll">_sqlite3.dll</a>.</p>
<p><b>Prerequisites</b><br/></p>
<ul>
<li>/bin/cygsqlite3-0.dll</li>
<li>/bin/libpython2.5.dll</li>
<li>/usr/include/sqlite3.h</li>
<li>/usr/include/python2.5/Python.h [et.c]
</li>
</ul>
<pre class="brush: sh">
tar jxf Python-2.5.2.tar.bz2 Python-2.5.2/Modules/_sqlite/
cd Python-2.5.2/Modules/_sqlite/
gcc -shared -o _sqlite3.dll -I /usr/include/python2.5 -L /bin -lpython2.5 -lsqlite3-0 -D&#039;MODULE_NAME=&quot;_sqlite3&quot;&#039; *.c
cp _sqlite3.dll /usr/lib/python2.5/lib-dynload/
</pre>
<p><b>download</b><br/><br />
<a href="/wordpress/wp-content/uploads/_sqlite3.dll">_sqlite3.dll</a></p>
<h2>Update 10 Sept 2008</h2>
<p>Download link fixed. (Thanks Steve)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.redmountainsw.com/wordpress/archives/cygwin-python-and-sqlite3/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
