Reading CSV files in IronPython

- 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
Automate repetitive tasks using AHK
by Mandar Vaze on February 26, 2009
in Productivity, Review, tips, windows

- Image via Wikipedia
I have been a big supporter of automation where possible. I was reading about how “ActiveWords” was the best piece of software, and that is when I became aware of AutoHotKey, or AHK as it is fondly called. I learned more about AHK on LifeHacker
Considering that I came to AHK looking for ActiveWords replacement, it is no wonder that I use Hotstrings feature extensively. It would not be wrong if I said that is probably the only feature of AHK I use. So let me explain How I use AHK to automate lot of repeatative tasks, mostly related to typing same set of words lot of times.
It would not be out of place to here to mention texter, AHK based tool developed by LH team.
Expand Acronymns
I have created Hotstrings for regularly used acronyms. When I type them, AHK will automagically expand them. This has a huge benefit that I am free to use the acronyms when I type, but my readers aren’t left wondering about what it means. Some of the commonly used ones are YMMV, AFAIK, BTW etc.
SMS style typing:
SMS is used extensively in India, so I’ve seen new professionals – fresh out of college – are used to new SMS-lingo. But in professional communication, it is a complete no-no. AH to the rescue, add your SMS word to your Hotstrings list and let AH complete it. I personally don’t SMS or IM as much, but I have seen people use ‘ur’ a lot, when they mean your.
Pleasantries:
I also have Hotstrings for likes of Regards, Thanks etc.
Frequently used names :
I have Hotstrings like bg=Bill, lt=Linus, esr=Eric etc. I work a lot with my counterparts in Japan where you address people using -san. So it helps to have HotStrings like gt=Takei-san.
Authentications :
I’m too paranoid to allow the browser to remember my username and password, so this is my next best thing. For company internal websites, I need to enter something like domain\username. I’ve created a hotstring like d\u. This is replaced by domain\username by AHK
Are there any negatives of AHK ?
Well, these aren’t the cons in true sense of the word, but there are some practical problems I face. After extended use of AHK Hotstrings, one may see following side effects :
- May forget correct spellings
- Feel like crippled without AHK on guest PC
Do let me know in comments how you use AHK or texter in your daily lives to automate the repetitive tasks.
Note : Originally posted on the Kaizen Blog on October 31st, 2007
Can’t use AHK ? because you are on Linux ? Don’t worry, come back to check the review of similar tool on Linx
Related articles by Zemanta
- Indians prefer phone calls to SMS (textually.org)
Integrate Rainlendar Calendar with Thunderbird
by Mandar Vaze on February 21, 2009
in Linux, Productivity, tips, windows
So after I started using Rainlendar as my Desktop calendar, now I had two calendars to maintain. One was Rainlendar Calendar, and other was Thunderbird calendar via lightning plugin. It would asoon get cumbersome to update both the calendars. Wouldn’t it be nice if they shared the same calendar ? If they did, irrespective of which calendar I use to create/update the events and taks, the other would always be in sync.
Unfortunately, the default file format used by Thunderbird ins’t .ics (or iCalendar format). By default, it stored the calendar in storage.db. But there is a way around it.
While Thunderbird does not use .ics file format for its own calendars by default, it supports use of iCalendar on the network (like Google Calendar) But Rainlendar calendar is not on the network. So you trick Thunderbird (or lightning, depending on the way you look at it)
- Go ahead, and create new calendar on network.
- choose .ics format, but use file:// protocol to point to existing calendar created by Rainlendar.
- Then you can delete the default one called Home. (If you have only once calendar, you are unable to delete it.)
Thanks to this thread on Ubuntu Forums for providing me this idea.
Related articles by Zemanta
- Postbox competes with Thunderbird using Mozilla code (news.cnet.com)
- Configuring Thunderbird to work with BlackBerry (bbgeeks.com)
- Thunderbird Archiving Shortcuts (ghacks.net)
![Reblog this post [with Zemanta]](http://img.zemanta.com/reblog_b.png?x-id=97b6f3b5-f068-4b14-accd-9a79a802c586)
![Reblog this post [with Zemanta]](http://img.zemanta.com/reblog_b.png?x-id=41ee9919-367c-478d-8eab-9734df4acf80)

![Reblog this post [with Zemanta]](http://img.zemanta.com/reblog_b.png?x-id=f3466f2d-5a5a-4c56-bd4c-dd3bf547e505)

