<?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>Desi Penguin’s Blog &#187; Python</title>
	<atom:link href="http://desipenguin.com/techblog/category/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://desipenguin.com/techblog</link>
	<description>Open source, Tech Tips, Reviews, Tutorials and more …</description>
	<lastBuildDate>Thu, 12 Jan 2012 18:16:35 +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>Installing gevent on shared hosting server</title>
		<link>http://desipenguin.com/techblog/2012/01/03/installing-gevent-on-shared-hosting-server/</link>
		<comments>http://desipenguin.com/techblog/2012/01/03/installing-gevent-on-shared-hosting-server/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 06:18:50 +0000</pubDate>
		<dc:creator>Mandar Vaze</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[shared hosting]]></category>

		<guid isPermaLink="false">http://desipenguin.com/techblog/?p=376</guid>
		<description><![CDATA[How would you install third party libraries to non-standard location on shared hosting environment ?]]></description>
			<content:encoded><![CDATA[<p>Recently, I had to install &#8220;gevent&#8221; python module on <a href="www.webfaction.com" target="_blank">webfaction</a>. Normally, I would install it using &#8220;pip install gevent&#8221; &#8211; Very straight forward. But python gevent module requires <a class="zem_slink" title="Libevent" rel="homepage" href="http://www.monkey.org/%7Eprovos/libevent/">libevent</a> library, specifically the .so file. This file normally resides in /usr/lib, but on shared host you do not have permissions to write to this location, hence the <em>normal</em> method wouldn&#8217;t work.  The trick is to install the .so in custom location, but more importantly, ask <em>pip</em> to use this non-standard location using <em>&#8211;install-option</em> command line option</p>
<p>Here are the steps I followed :</p>
<blockquote>
<div id="_mcePaste">wget https://github.com/downloads/libevent/libevent/libevent-1.4.13-stable.tar.gz</div>
<div id="_mcePaste">tar xvzf libevent-1.4.13-stable.tar.gz</div>
<div id="_mcePaste">mkdir ~/externals</div>
<div id="_mcePaste">cd libevent-1.4.13-stable</div>
<div id="_mcePaste">./configure &#8211;prefix=$HOME/externals/</div>
<div id="_mcePaste">make</div>
<div id="_mcePaste">make install</div>
<div id="_mcePaste">pip install &#8211;install-option=&#8221;-I$HOME/externals/include&#8221; &#8211;install-option=&#8221;-L$HOME/externals/lib&#8221; gevent</div>
</blockquote>
<div>In the above steps $HOME is taken only as an example, feel free to install it at other locations, and pass the appropriate path to <em>-I</em> and <em>-L</em> as arguments.</div>
<div>While the example above talks about libevent, This method works well for other software as well.</div>
]]></content:encoded>
			<wfw:commentRss>http://desipenguin.com/techblog/2012/01/03/installing-gevent-on-shared-hosting-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django 1.2.1 : Page Not Found :/</title>
		<link>http://desipenguin.com/techblog/2010/09/18/django-1-2-1-page-not-found/</link>
		<comments>http://desipenguin.com/techblog/2010/09/18/django-1-2-1-page-not-found/#comments</comments>
		<pubDate>Sat, 18 Sep 2010 17:05:54 +0000</pubDate>
		<dc:creator>Mandar Vaze</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Web Frameworks]]></category>

		<guid isPermaLink="false">http://desipenguin.com/techblog/?p=369</guid>
		<description><![CDATA[This was my first instance of installing Django and deploying a third party app on it. After deploying the Django-App, I started the app using &#8220;python manage.py runserver&#8221; It seemed to have started cause I got the following message :
Validating models&#8230;
0 errors found
Django version 1.2.1, using settings &#8216;xxx.settings&#8217;
Development server is running at http://127.0.0.1:8000/
Quit the server [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.djangoproject.com/"><img class="alignright" title="Django" src="http://media.djangoproject.com/img/site/hdr_logo.gif" alt="Django" width="117" height="41" /></a>This was my first instance of installing <a class="zem_slink" title="Django (web framework)" rel="homepage" href="http://www.djangoproject.com">Django</a> and deploying a third party app on it. After deploying the Django-App, I started the app using &#8220;<em><span class="zem_slink">python</span> manage.py runserver</em>&#8221; It seemed to have started cause I got the following message :</p>
<blockquote><p>Validating models&#8230;<br />
0 errors found</p>
<p>Django version 1.2.1, using settings &#8216;xxx.settings&#8217;<br />
Development server is running at http://127.0.0.1:8000/<br />
Quit the server with CTRL-BREAK.</p></blockquote>
<p>But when I visited the page http://127.0.0.1:8000/ (or http://127.0.0.1:8000/admin) I would get &#8220;Page Not Found :/&#8221; (or &#8220;Page Not Found :/admin&#8221; &#8211; depending on which page I tried to launch) Since I was trying this app for the first time, I suspected that this must be the problem with the app. I checked with other folks who worked on this project, but I couldn&#8217;t get any help.  While reading the Django documentation further &#8211; I came across an option to &#8220;runserver&#8221; command where one can start the server on non-default port. As part of troubleshooting, I just tried it, not hoping for much success, but it worked.</p>
<p>Now I am thinking why doesn&#8217;t the app work on default port, but works on non-default port. So I stopped the server (running on non-default port) and tried the URL again. I still got the &#8220;Page not found&#8221; error, and this made it clear that, some other server was listening on port 8000.  Eventually I was find out the process that was listening on port 8000 using the following command :</p>
<blockquote><p><a class="zem_slink" title="Netstat" rel="wikipedia" href="http://en.wikipedia.org/wiki/Netstat">netstat</a> -ao | findstr LISTENING</p></blockquote>
<p>Option &#8216;0&#8242; prints the <a class="zem_slink" title="Process identifier" rel="wikipedia" href="http://en.wikipedia.org/wiki/Process_identifier">process ID</a> &#8211; I was able to find out the eecutable using ProcExp (which has replaced my Task Manager) On linux &#8211; use &#8220;<a class="zem_slink" title="Grep" rel="wikipedia" href="http://en.wikipedia.org/wiki/Grep">grep</a>&#8221; in place of &#8220;findstr&#8221; and &#8220;ps&#8221; can be used to find out the executable</p>
<p>What surprised me was even though some process is already listening on default port 8000, How did Django &#8220;runserver&#8221; did not give an error when it tries to bind to port 8000.  This can be reproduced easily by running two instances of same app (or two different apps) from two different terminals. Second instance should fail while binding to default port &#8211; and I expect it to show error &#8211; But it doesn&#8217;t. If it matters I was using Django 1.2.1 on Windows XP (Python 2.6)</p>
<p>All in all, It was very interesting to <a class="zem_slink" title="Troubleshooting" rel="wikipedia" href="http://en.wikipedia.org/wiki/Troubleshooting">troubleshoot</a> the problem.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/zemified_a.png?x-id=24d0b19d-baf6-4b16-bfb0-a70002055f67" alt="Enhanced by Zemanta" /></a><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://desipenguin.com/techblog/2010/09/18/django-1-2-1-page-not-found/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Why SharpDevelop is better IDE ?</title>
		<link>http://desipenguin.com/techblog/2009/07/10/why-sharpdevelop-is-better-ide/</link>
		<comments>http://desipenguin.com/techblog/2009/07/10/why-sharpdevelop-is-better-ide/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 16:51:26 +0000</pubDate>
		<dc:creator>Mandar Vaze</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Review]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[.NET Framework]]></category>
		<category><![CDATA[Languages]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://desipenguin.com/techblog/?p=316</guid>
		<description><![CDATA[



Image via Wikipedia



In my first post about IronPython, I documented how installing IronPython Studio was painful (Needed Visual Studio shell, which in itself was confusing). When I started with IronPython I did not know about any other IDE, hence I went ahead with IronPython Studio. But later I came to know about SharpDevelop.
My initial problem [...]]]></description>
			<content:encoded><![CDATA[<div class="zemanta-img" style="margin: 1em; display: block;">
<div>
<dl class="wp-caption alignleft" style="width: 266px;">
<dt class="wp-caption-dt"><a href="http://en.wikipedia.org/wiki/Image:SharpDevelop.png"><img title="SharpDevelop" src="http://upload.wikimedia.org/wikipedia/en/thumb/b/b6/SharpDevelop.png/300px-SharpDevelop.png" alt="SharpDevelop" width="256" height="177" /></a></dt>
<dd class="wp-caption-dd zemanta-img-attribution" style="font-size: 0.8em;">Image via <a href="http://en.wikipedia.org/wiki/Image:SharpDevelop.png">Wikipedia</a></dd>
</dl>
</div>
</div>
<p>In my <a href="http://desipenguin.com/techblog/2009/06/23/ironpython/" target="_blank">first post</a> about <a class="zem_slink" title="IronPython" rel="homepage" href="http://www.codeplex.com/IronPython">IronPython</a>, I documented how installing IronPython Studio was painful (Needed Visual Studio shell, which in itself was confusing). When I started with IronPython I did not know about any other IDE, hence I went ahead with IronPython Studio. But later I came to know about <a class="zem_slink" title="SharpDevelop" rel="homepage" href="http://sharpdevelop.com/">SharpDevelop</a>.</p>
<p>My initial problem with SharpDevelop was that it needed .NET 3.5 SP1 at the minimum. I had just gone through the painful exercise of downloading and installing the prerequisites for IronPython Studio. So I was in no mood of downloading another big chunk before I can start my IronPython Development. But once I got past my initial development cycle, I wanted to give Sharp Develop a try.</p>
<p>After using both the ID interchangeably, I finally settled on SharpDevelop as my choice for IronPython Development</p>
<h3><span id="more-316"></span></h3>
<h3>Why SharpDevelop ?</h3>
<blockquote><p><strong>#develop (short for SharpDevelop) is a free IDE for C#, VB.NET and Boo projects</strong> on Microsoft&#8217;s .NET platform</p></blockquote>
<p>To begin with it is completely free and open source. We like Open Source.  But IronPython Studio is also Free and Open Source. But it needs Visual Studio shell from MS.  There is nothing wrong with that, I think it is a design philosophy. IronPython Studio was probably built with the sole purpose of supporting IronPython IDE. So the developers must have assumed that anyone doing development on MS platform would typically use Visual Studio. Since MS has a free version of Visual Studio, cost is non-issue. That is why IronPython Studio is available in two modes : integrated mode and isolated mode.  Assuming that existence of Visual Studio shell helps in reducing the download size. While IronPython Studio was less than 1MB, Sharp Develop on the other hand is whopping 18 MB.</p>
<p>On the other hand, SharpDevelop was built from ground up with the goal of providing a completely open source alternative to Visual Studio. As the name suggests, probably very first language it supported was C#, and then added support for VB.NET and Boo (and IronPython as of 3.0) one by one.</p>
<h3>Support for Visual Studio Solution files</h3>
<p>While SharpDevelop aims to be complete alternative for Visual Studio, I think they realize that in real world there are bound to be projects which already have .sln files. So it is important to support .sln files. IronPython Studio on the other hand insists on creating its own .pysln files.</p>
<p>While .pysln may be OK for Standalone IronPython Development, SharpDevelop approach of supporting solution files will be useful when one tries to use IronPython code with other .NET languages like VB.Net and C# (To be fair both use .pyproj project files, which can be open interchangeably in any IDE &#8211; But IronPython Studio insisted on creating its own .pysln file when it opened .pyproj)</p>
<p>While I have not used integrated mode of IronPython Studio, SharpDevelop inherently supports multiple .NET languages. It also has feature to convert VB.net code into IronPython. Now how cool is that ?</p>
<h3>Third party tools</h3>
<p>One of the menu items in SharpDevelop is titled &#8220;Quality Tools&#8221;. I liked the fact that an IDE cares enough about the quality to integrate various third party tools. It has built in option for Profiler, <a class="zem_slink" title="StyleCop" rel="wikipedia" href="http://en.wikipedia.org/wiki/StyleCop">StyleCop</a>, <a class="zem_slink" title="FxCop" rel="wikipedia" href="http://en.wikipedia.org/wiki/FxCop">FxCop</a>, as well as <a class="zem_slink" title="NUnit" rel="homepage" href="http://www.nunit.com/">NUnit</a>.  Some of these tools require a third party DLL to work, but that is fair enough.</p>
<p>SharpDevelop also recognized that <a class="zem_slink" title="TortoiseSVN" rel="homepage" href="http://tortoisesvn.tigris.org">TortoiseSVN</a> was installed and supported Subversion operations from within the IDE. On the other hand,  free Visual Studio plugin for SVN &#8211; <a class="zem_slink" title="AnkhSVN" rel="homepage" href="http://ankhsvn.net/">AnkhSVN</a> &#8211; doesn&#8217;t work with free (Express) version of Visual Studio.</p>
<p>So does that mean SharpDevelop is the ultimate IDE for IronPython development ? Not quite. There are certain things that didn&#8217;t quite work for me.</p>
<h3>Code completion missing ?</h3>
<p>Since most of my development has been on *nix platform, I haven&#8217;t used much of IDEs. I used Eclipse once is a while for some Java Development, but always felt it to be slow. For pure Python development, I prefer <a class="zem_slink" title="ActiveState Komodo" rel="homepage" href="http://www.activestate.com/komodo/">Komodo free IDE</a> on both Ubuntu as well as Windows.  I have also tried Eclipse 3.5 with built-in support for Dynamic languages for Python development on Ubuntu. But none of these provided the auto completion (or intellisense as sometimes it is referred) feature for python/ironpython. I read on one of the blogs that SharpDevelop 3.1 supports code completion for IronPython, but for some reason I was not able to get it working for me (Please let me know in comments, if you know of any configuration that may be required for this)</p>
<h3>Folding doesn&#8217;t quite work</h3>
<p>Another big feature I missed (as compated to Komodo free version) was how folding worked. SharpDevelop support folding only for the code inside a class. Most of code is outside of any of the classess &#8211; so I get no folding. Komodo on the other hand support folding for as small as if block.</p>
<h3>Closing Remarks</h3>
<p>In coming days, I need to integrate my code with VB.Net application. I plan to use SharpDevelop for the entire development. If my colleagues can&#8217;t figure out that I am not using Visual Studio, I may suggest the rest of the development team to also try SharpDevelop (and save some buck for the organization &#8211; that would be pretty big saving)</p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 460px; width: 1px; height: 1px;">in comments</div>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/41035723-ab8c-4afa-a80a-aa40c8e97aae/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/reblog_c.png?x-id=41035723-ab8c-4afa-a80a-aa40c8e97aae" alt="Reblog this post [with Zemanta]" /></a><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://desipenguin.com/techblog/2009/07/10/why-sharpdevelop-is-better-ide/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Reading CSV files in IronPython</title>
		<link>http://desipenguin.com/techblog/2009/07/03/reading-csv-files-in-ironpython/</link>
		<comments>http://desipenguin.com/techblog/2009/07/03/reading-csv-files-in-ironpython/#comments</comments>
		<pubDate>Fri, 03 Jul 2009 16:13:12 +0000</pubDate>
		<dc:creator>Mandar Vaze</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[Development Tools]]></category>
		<category><![CDATA[IronPython]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://desipenguin.com/techblog/?p=294</guid>
		<description><![CDATA[



Image via Wikipedia



This is in continuation with my previous blog post :
To get IronPython to use Standard Python Modules,  one needs to add  the following two lines to C:\IronPython-2.0.1\Lib\site.py :
import sys
sys.path.append(r"C:\Python25\Lib")
While this works for most part, it doesn’t help if you are using Python extensions written in C. More about my specific problems in [...]]]></description>
			<content:encoded><![CDATA[<div class="zemanta-img" style="margin: 1em; display: block;">
<div>
<dl class="wp-caption alignright" style="width: 123px;">
<dt class="wp-caption-dt"><a href="http://en.wikipedia.org/wiki/Image:CsvDelimited001.svg"><img title="stylized depiction of a csv text file" src="http://upload.wikimedia.org/wikipedia/en/thumb/3/38/CsvDelimited001.svg/113px-CsvDelimited001.svg.png" alt="stylized depiction of a csv text file" width="113" height="113" /></a></dt>
<dd class="wp-caption-dd zemanta-img-attribution" style="font-size: 0.8em;">Image via <a href="http://en.wikipedia.org/wiki/Image:CsvDelimited001.svg">Wikipedia</a></dd>
</dl>
</div>
</div>
<p>This is in continuation with my <a href="http://desipenguin.com/techblog/2009/06/23/ironpython/" target="_blank">previous</a> blog post :</p>
<blockquote><p><span>To get <a class="zem_slink" title="IronPython" rel="homepage" href="http://www.codeplex.com/IronPython">IronPython</a> to use Standard <a class="zem_slink" title="Python (programming language)" rel="homepage" href="http://www.python.org/">Python</a> Modules,  one needs to</span> add  the following two lines to <em>C:\IronPython-2.0.1\Lib\site.py</em> :</p>
<pre>import sys
sys.path.append(r"C:\Python25\Lib")</pre>
<p>While this works for most part, it doesn’t help if you are using Python extensions written in C. More about my specific problems in another post. But there is an open source project <a href="http://code.google.com/p/ironclad/" target="_blank">IronClad</a> to deal specifically with this issue. In the meantime, you can check  <a href="http://ironpython.codeplex.com/Wiki/View.aspx?title=Differences" target="_blank">the differences between IronPython and CPython</a></p></blockquote>
<p>Reading (and writing to) <a class="zem_slink" title="Comma-separated values" rel="wikipedia" href="http://en.wikipedia.org/wiki/Comma-separated_values">CSV</a> file is critical part of my program, while in stadard python it was as easy as &#8220;import csv&#8221;, the same thing took some efforts to get it working in IronPython. I got the following error for my import statement</p>
<pre>Error on line 7 in csv.py
from functools import reduce</pre>
<p>I also tried using <a class="zem_slink" title="ActivePython" rel="wikipedia" href="http://en.wikipedia.org/wiki/ActivePython">ActiveState Python</a> 2.5.2.2 (which I already had from few months ago, didn&#8217;t feel like downloading the latest version till the problem was fixed) But that didn&#8217;t help either. With ActiveState, I got the same error on the same line, except this time it was for _csv.</p>
<p>To Quote from <a href="http://www.ironpython.info/index.php/Reading_CSV_Files" target="_blank">IronPython Cookbook</a> :</p>
<blockquote><p>For some reason the Python standard library <a class="external text" title="http://docs.python.org/lib/module-csv.html" href="http://docs.python.org/lib/module-csv.html">csv module</a> is written in C, which means that it isn&#8217;t available to IronPython.</p></blockquote>
<p>The cookbook points to a third party library called <a href="http://www.codeproject.com/KB/database/CsvReader.aspx" target="_blank">A Fast Csv Reader</a> . The cookbook has a nice example of how to use the said DLL with your IronPython Program.</p>
<p>It wasn&#8217;t clear to me as to why I had to register at Code Project to download this binary since it is provided under <a href="http://en.wikipedia.org/wiki/MIT_License" target="_blank">MIT Open Source License</a>. But whom am I gonna complain to ? Beggars can&#8217;t be choosers <img src='http://desipenguin.com/techblog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/97b6f3b5-f068-4b14-accd-9a79a802c586/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/reblog_b.png?x-id=97b6f3b5-f068-4b14-accd-9a79a802c586" alt="Reblog this post [with Zemanta]" /></a><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://desipenguin.com/techblog/2009/07/03/reading-csv-files-in-ironpython/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IronPython</title>
		<link>http://desipenguin.com/techblog/2009/06/23/ironpython/</link>
		<comments>http://desipenguin.com/techblog/2009/06/23/ironpython/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 17:11:23 +0000</pubDate>
		<dc:creator>Mandar Vaze</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Review]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[Development Tools]]></category>
		<category><![CDATA[IronPython]]></category>
		<category><![CDATA[Microsoft Visual Studio]]></category>

		<guid isPermaLink="false">http://desipenguin.com/techblog/?p=288</guid>
		<description><![CDATA[



Image by Michael Foord via Flickr



After working on initial prototype using pylons, on ubuntu, my employer needed a standalone application (on windows) So I was looking for ways to reuse my python code to avoid double work.  had only heard about iron python but beyond that I did not know anything more.
A bit of research [...]]]></description>
			<content:encoded><![CDATA[<div class="zemanta-img" style="margin: 1em; display: block;">
<div>
<dl class="wp-caption alignleft" style="width: 138px;">
<dt class="wp-caption-dt"><a href="http://www.flickr.com/photos/13483019@N00/3225539390"><img title="IronPython in Action" src="http://farm4.static.flickr.com/3428/3225539390_e512d00174_m.jpg" alt="IronPython in Action" width="128" height="160" /></a></dt>
<dd class="wp-caption-dd zemanta-img-attribution" style="font-size: 0.8em;">Image by <a href="http://www.flickr.com/photos/13483019@N00/3225539390">Michael Foord</a> via Flickr</dd>
</dl>
</div>
</div>
<p>After working on initial prototype using <a class="zem_slink" title="Pylons (web framework)" rel="homepage" href="http://www.pylonshq.com/">pylons</a>, on ubuntu, my employer needed a standalone application (on windows) So I was looking for ways to reuse my python code to avoid double work.  had only heard about iron python but beyond that I did not know anything more.</p>
<p>A bit of research later, I downloaded IronPython from <a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=IronPython" target="_blank">here</a> and<a href="http://www.codeplex.com/IronPythonStudio" target="_blank"> IronPython Studio</a>. I was quite thrilled to find out that Microsoft, has created this shell, which allows developers to integrate new languages with Visual Studio Shell.</p>
<h2>Installing IronPython Studio</h2>
<p>Installing IronPython was very straight forward. Considering it is one of the Python implementation itself, you don&#8217;t have to have standard python installed. (But I did, more on that later)</p>
<p>Setting up IronPython Studio wasn&#8217;t so straight forward.  I had to download standalone version of Visual Studio shell. But the problem, and it is well documented, is that installing the redistributable package in itself is not the complete step, as you would believe from the website. I confirmed that the package was installed, and stil IronPython Studio would complain, and refuse to proceed. It turns out that you need to install the Visual Studio environment, which is inside this directory structure you just created.</p>
<div id="attachment_290" class="wp-caption aligncenter" style="width: 613px"><img class="size-full wp-image-290" title="Visual Studio Redistributable Package " src="http://desipenguin.com/techblog/wp-content/uploads/2009/06/VS2K8-Isolated.JPG" alt="This is NOT enough" width="603" height="97" /><p class="wp-caption-text">This is NOT enough</p></div>
<div id="attachment_291" class="wp-caption aligncenter" style="width: 612px"><img class="size-full wp-image-291" title="Visual Studio Shell 2008" src="http://desipenguin.com/techblog/wp-content/uploads/2009/06/VS-Shell2K8.JPG" alt="This is what IronPython Studio needs" width="602" height="97" /><p class="wp-caption-text">This is what IronPython Studio needs</p></div>
<p>Once I installed Visual Studio Shell, IronPython Studio installed easily.  Using IronPython has been nice experience in just a few hours I have been using it. The Code completion isn&#8217;t upto my liking yet, but it is helpful at times.</p>
<h2>Using Standard Python Libraries</h2>
<p>Since my original code was written on linux, it used only the standard python modules. In a manner of speaking, it was &#8220;pure&#8221; python code. Since <em>IronPython is </em><span id="ctl00_ctl00_MasterContent_Content_wikiSourceLabel"><em>an implementation of the Python programming language running under .NET</em>, it was obivious that my code may not work as is. But I&#8217;m glad that I did not have to make too many changes to get it working under IronPython. </span></p>
<p><span>As is well documented in IronPython Tutorial, it is not very difficult to use standard python libraries with IronPython (with a few exceptions &#8211; more about this a little later) To get IronPython to use Standard Python Modules,  one needs to</span> add  the following two lines to <em>C:\IronPython-2.0.1\Lib\site.py</em> :</p>
<pre>import sys
sys.path.append(r"C:\Python25\Lib")</pre>
<p>While this works for most part, it doesn&#8217;t help if you are using Python extensions written in C. More about my specific problems  in another post. But there is an open source project <a href="http://code.google.com/p/ironclad/" target="_blank">IronClad</a> to deal specifically with this issue. In the meantime, you can check  <a href="http://ironpython.codeplex.com/Wiki/View.aspx?title=Differences" target="_blank">the differences between IronPython and CPython</a></p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 289px; width: 1px; height: 1px;">http://www.codeplex.com/IronPythonStudio</div>
<p><strong>Related articles</strong></p>
<ul>
<li><a href="http://blogs.msdn.com/hugunin/archive/2009/04/14/ironpython-in-action.aspx"> IronPython in Action </a> (blogs.msdn.com)</li>
<li><a href="http://www.mehmetalierturk.com/2009/05/04/why-python/"> Why Python? </a> (mehmetalierturk.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/d57dd1e2-9cff-474f-9b2e-8f575bf5d8b3/"><img class="zemanta-pixie-img" style="border: medium none ; float: right;" src="http://img.zemanta.com/reblog_b.png?x-id=d57dd1e2-9cff-474f-9b2e-8f575bf5d8b3" alt="Reblog this post [with Zemanta]" /></a><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://desipenguin.com/techblog/2009/06/23/ironpython/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

