Reading CSV files in IronPython

stylized depiction of a csv text file
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 another post. But there is an open source project IronClad to deal specifically with this issue. In the meantime, you can check the differences between IronPython and CPython

Reading (and writing to) CSV file is critical part of my program, while in stadard python it was as easy as “import csv”, the same thing took some efforts to get it working in IronPython. I got the following error for my import statement

Error on line 7 in csv.py
from functools import reduce

I also tried using ActiveState Python 2.5.2.2 (which I already had from few months ago, didn’t feel like downloading the latest version till the problem was fixed) But that didn’t help either. With ActiveState, I got the same error on the same line, except this time it was for _csv.

To Quote from IronPython Cookbook :

For some reason the Python standard library csv module is written in C, which means that it isn’t available to IronPython.

The cookbook points to a third party library called A Fast Csv Reader . The cookbook has a nice example of how to use the said DLL with your IronPython Program.

It wasn’t clear to me as to why I had to register at Code Project to download this binary since it is provided under MIT Open Source License. But whom am I gonna complain to ? Beggars can’t be choosers :(

Reblog this post [with Zemanta]

How to Fix the look ‘n feel of GTK Apps in KDE

As all the Ubuntu users know, the default Ubuntu comes with Gnome. Kubuntu is a separate download, focused around K-apps. But I wanted best of both the worlds. It was easy to have both. I just followed the instructions from this page.

Personally, I think KDE 4.x is pretty nice. It comes with host of applications. I think KDE is cool (.. and acknowledge that cool is subjective – personal.)

Since I moved to KDE from Gnome,  I have become dependent on several GTK apps. (GTK is the cross platform widget library used to write the Gnome applications) But by default they don’t look good in KDE.

  1. Firefox tabs would merge into each other, and visually I could not differentiate the boundaries.
  2. Firefox scrollbars didn’t work correctly either
  3. Gnome DO had weird problem, as is the drop-down list which allows me to select the theme went completely bonkers.
  4. The Edit box in Autokey is completely Hidden (See the image Above)

Something had to be done. See the images below. Click on the images to see the details.

Autokey in KDE - Default

The Edit Box is missing

Edit box visible after the dialog is resized

Edit box visible after the dialog is resized

moz_in_kde1

The tab boundaries merged

Follow these simple instructions to ensure that GTK apps “play well” with KDE

  1. Go to System Settings ->Appearance
  2. Click on “GTK Styles and fonts” from the left hand side panel
  3. The very first (at the top) option is GTK Styles. The Default is use KDE Style. Select USe Another Style.
  4. Select Clearlooks (For blue) or Human Clearlooks from the drop down.
  5. You need to restart the GTK Apps.

Now all your KDE/QT apps as well as GTK apps would work well (in terms of display)

See the screen shots after the above fix is applied. Click on the images to see the details.

The Edit box visible clearlt - As designed

The Edit box visible clearly - As designed

Tab Boundaries Visible Clearly

Tab Boundaries Visible Clearly

Reblog this post [with Zemanta]

Installing latest Gnome Do on Ubuntu 8.10

Screenshot of GNOME Do

Image via Wikipedia

If you are not sure what is Gnome Do, read my previous post on this topic. Ubuntu 8.10 repositories has older version 0.6.0.1 of Gnome-DO. This was probably released around October 2008 time frame when Ubuntu 8.10 was released. It has been several months since then, and Gnome DO has progressed nicely.

If you want to try the latest version of Gnome DO, which now comes with Docky, then read on How to upgrade to latest version.

Read more..

Next Page »