<?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>Unwrongest &#187; python</title>
	<atom:link href="http://www.unwrongest.com/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.unwrongest.com</link>
	<description>Interaction Designer and Interface Developer</description>
	<lastBuildDate>Wed, 30 Jun 2010 11:24:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>How to fix &#8216;ImportError: No module named X&#8217; in Python</title>
		<link>http://www.unwrongest.com/blog/how-to-fix-importerror-no-module-named-x-in-python/</link>
		<comments>http://www.unwrongest.com/blog/how-to-fix-importerror-no-module-named-x-in-python/#comments</comments>
		<pubDate>Fri, 24 Oct 2008 21:56:23 +0000</pubDate>
		<dc:creator>Jan Jarfalk</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://unwr/?p=71</guid>
		<description><![CDATA[The problem is your python path, or rather the lack of one. You need to set environment variable PYTHONPATH to the absolute path of the missing module. One way of doing it is to append the path with in python.]]></description>
			<content:encoded><![CDATA[<p>The problem is your python path, or rather the lack of one. You need to set environment variable PYTHONPATH to the absolute path of the missing module. One way of doing it is to append the path with in python.</p>
<pre class="brush:python">
import sys
sys.path.append('/path/to/module')
</pre>
<p>Here is example from the real world. When I tried to compress the Netflixprize dataset using the pythonscript pyflix it returned this error.</p>
<pre class="brush:python">
Traceback (most recent call last):
  File "pyflix/setup.py", line 13, in <module>
    from pyflix import timeCall
ImportError: No module named pyflix
</pre>
<p>My solution to the problem was to add two lines of code in the beginning of setup.py. Notice the import on line seven and the appending of a path on line eight.</p>
<pre class="brush:python">
#!/usr/bin/env python

'''Script for generating the indexed binary datasets.'''

#==== imports ==================================================================

import sys
sys.path.append('/users/janjarfalk/projects/netflixprize/pyflix-0.1')

import cPickle
from operator import itemgetter
from optparse import OptionParser, make_option

import numpy as N

from pyflix import timeCall
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.unwrongest.com/blog/how-to-fix-importerror-no-module-named-x-in-python/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to install mysql-python on Apple OS X Leopard</title>
		<link>http://www.unwrongest.com/blog/how-to-install-mysql-python-on-apple-os-x-leopard/</link>
		<comments>http://www.unwrongest.com/blog/how-to-install-mysql-python-on-apple-os-x-leopard/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 21:49:58 +0000</pubDate>
		<dc:creator>Jan Jarfalk</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://unwr/?p=69</guid>
		<description><![CDATA[How to solve "Setup script exited with error: command 'gcc' failed with exit status 1" on a Macbook Pro running Apple OS X Leopard 10.5.5 when installing mysql-python.]]></description>
			<content:encoded><![CDATA[<p>When I tried to build and install mysql-python, on my Macbook Pro running Apple OS X Leopard 10.5.5, I encountered a few problems (<strong>Setup script exited with error: command &#8216;gcc&#8217; failed with exit status 1</strong>). But thanks to Google and the Python community, there were no problems that couldn&#8217;t be fixed.</p>
<h3>Step 1 &#8211; Download and extract mysql-python</h3>
<p>Let&#8217;s take it from the top. First you need to download mysql-python from <a href="http://sourceforge.net/projects/mysql-python">the Sourceforge project page</a> and extract the files.</p>
<h3>Step 2 &#8211; Locate and edit _mysql.c</h3>
<p>Locate the <strong>_mysql.c</strong> file in your mysql-python directory, open it up and remove the following three rows around row 35.</p>
<pre class="brush:js">
#ifndef uint
#define uint unsigned int
#endif
</pre>
<p>Still in <strong>_mysql.c</strong>, you should change the following two rows around row 480.</p>
<pre class="brush:js">
uint port = MYSQL_PORT;
uint client_flag = 0;
</pre>
<p>Change those two rows to:</p>
<pre class="brush:js">
unsigned int port = MYSQL_PORT;
unsigned int client_flag = 0;
</pre>
<h3>Step 3 &#8211;  Fix the mysql_config location (not always necessary)</h3>
<p>You might need to open up the site.cfg file in your mysql-python directory and change the path to your mysql_config.</p>
<pre class="brush:js">
#mysql_config = /path to your mysql_config
</pre>
<h3>Step 4 &#8211; Open up your terminal</h3>
<p>You will need to create a symbolic link between /usr/local/mysql/lib and /usr/local/mysql/lib/mysql. Open up your terminal and do the following.</p>
<pre class="brush:js">
$ sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql
</pre>
<h3>Step 4 &#8211; Rebuild and install</h3>
<p>All done! You should be able to build and install mysql-python now. With your terminal in the mysql-python directory you should do the following.</p>
<pre class="brush:js">
$ sudo python setup.py build
$ sudo python setup.py install
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.unwrongest.com/blog/how-to-install-mysql-python-on-apple-os-x-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
