Sunday, December 17, 2006

Bangalore Python Conference

(Disclaimer: This is not an official announcement/news)

BangPypers [1] is planning a "Bangalore Python Conference" [2] in next February or March.

According to Ramdas from DevelopeIQ, there are at least 5000 Pythonistas in Bangalore [3].

This may be true, I know there are two scientific talks going to happen in my near by place, (but I won't be attending it, I am not a scientific guy). Those scientific talks uses Python at "FOSS in Science" (National Workshop on Free Software in Science) on 4-6 January, 2007 [4]
(Venue: Union Christian College, Alwaye, Kochi, Kerala)
a. Scientific Computing and Data Visualization using Python -Dr. Prabhu Ramachandran, IIT Bombay [5]
b. Experimental Physics with Phoenix -Mr. Pramode C.E [6]

I think there are many Python programmers all over India. May be we need an "Indian Python Conference" soon.


Tuesday, November 21, 2006

Python talk at NSS Palakkad, Kerala

Yesterday, I had a talk on Python at N S S College of
Engineering, Palakkad ( . The talk was
arranged by the computer science student's free software
community. There were 100+ students. I used the same slides
which I prepared for my another talk in last
September (
I took almost 1 and 1/2 hours.

Sunday, November 5, 2006

My Marriage

My marriage is on next Sunday (12 November 2006).
I will be away from net for few days :)

Wednesday, November 1, 2006

First look at test layers from zope.testing

Recently Zope team has released zope.testing version 3.0 .
For more info :
To install : # easy_install zope.testing

This is an independent testing framework which can be used outside Zope.
One of the interesting feature is test layers. I think next Zope 3 release (3.4)
will make use test layers heavily, so I started looking at this feature.

The test layer API is here:

I will show you a simple example.

First a '':

def hello():
return 'Hello'

Then '':

import hello
import unittest

class FirstLayer(object):

class TestHello(unittest.TestCase):
layer = FirstLayer
def test_hello(self):
assert hello.hello() == 'Hello'

def test_suite():
return unittest.TestSuite((unittest.makeSuite(TestHello)))

The only thing to note here is the 'layer' attribute of 'TestHello' class.
We can add 'setUp' and 'tearDown' methods to 'FirstLayer' class.

Now create a script, '':

import sys
from zope.testing import testrunner
defaults = ['--test-path', '.', '--tests-pattern', 'tests$',]

When running the script, you will get something like:

Running tests.FirstLayer tests:
Set up tests.FirstLayer in 0.000 seconds.
Ran 1 tests with 0 failures and 0 errors in 0.000 seconds.
Tearing down left over layers:
Tear down tests.FirstLayer in 0.000 seconds.

Monday, October 23, 2006

New Zope 3 wiki

New Zope 3 wiki :

This will be available from later.

Tuesday, October 17, 2006

Pythonic blog is not dynamically typed ?!

I am a frequent visitor of Planet Python, also a subscriber. I also visit and regularly. I liked all
kinds of posts. The policy of Ubuntu and GNOME planets are given at top of
their pages.

"Planet GNOME is a window into the world, work and lives of GNOME hackers and


"Planet Ubuntu is a window into the world, work and lives of Ubuntu developers
and contributors."

Previously I have written an entry about this:

I expect at least a sentence about the policy of Planet Python, so that I can
adjust my feeds according to that. I think this will be useful for others too.
IMHO, it should be something similar to the above mentioned policies.

Monday, October 16, 2006

Python advocacy and marketing

I was reading Tarek's post on Python marketing:

He suggests a Python certification program.

Is this list created for discussion related to Python Advocacy?.
But I cann't see any posts there (hmm.. I send one in last month, just to test)

Wedding invitation

Yesterday (Sunday) I went to Tomy's home and invited them for my marriage.
Before that I spend about 2 hours with Nithya at 'Idavazhi'. Later I went
to core for sending invitation to Kotas. I scanned letter and send to them.
Today I will send it to Arun,Dideesh etc.

Saturday, October 14, 2006

Well, actually this is test

I was thinking about writing a diary recently. In fact I forget many things.
I think it has a good aspect, yes forgetting. But there is nothing wrong
if we record it somewhere. Sometimes we can go through the old archives and
see what you were doing. Why ? nothing.. just to see .. that's all.
Now I am sitting in office, soorjith is just opposite to me.
Nandu and a new programmer (Sachin) is in the next room.
I have to teach him (Sachin) some technologies we use.
Well..I am going there now. But before that I have to make a commit.

any and all built-in functions in Python 2.5

Oh! this is very nice:

$ python2.5
Python 2.5 (r25:51908, Sep 27 2006, 12:21:46)
[GCC 3.3.5 (Debian 1:3.3.5-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> any
built-in function any
>>> all
built-in function all
>>> print any.__doc__
any(iterable) -> bool

Return True if bool(x) is True for any x in the iterable.
>>> print all.__doc__
all(iterable) -> bool

Return True if bool(x) is True for all values x in the iterable.
>>> any([1,2])
>>> all([1,2])
>>> any([1,0])
>>> all([1,0])

Hey, I have made few edits here, (blame livejournal's `pre` tag), noticed it ? :)

Friday, October 6, 2006

Happy Birthday to Plone!

Plone celebrate its fifth anniversary:

I am an outsider to this community, but I have always watched this project.
In my opinion, plone is

- a great project
- a great product
- a great community

And it has great leadership also.

I think community building is much more than creating a big project.
May be creating a community with lots of buzz is possible, but making it active always
is not easy. And code base is not the only thing required for a successful project.
Plone is a great success compared to many other big projects.

Thursday, September 28, 2006

Python 2.5, Zope 3.3 releases

This month my favourite programming language and web framework relased newer
versions. I reported Python release here: Oh! many people dugg it.
But I was afraid of Zope 3 release there :) Though, I have written an article

Using Personal Wiki

Recently I realised that using a personal wiki for documentation is better than
a public one. (Why ?). Well, the main reason is that you get more freedom and
courage. I will be more cautious when adding content to public wiki.
And my favourite wiki is ZWiki.

Tuesday, September 19, 2006

A work in progress chapter from Zope Guide

This is a work in progress chapter from Zope Guide:
Please contribute! especially grammer mistakes :)

Unit testing


In this chapter, you will learn more about unit testing. Zope 3 use `doctest`
based unit testing heavily. Zope 3 preferes test driven development (TDD).

To explain the idea, consider a use case. A module is required with a function
which returns 'Good morning, name!'. The name will be given as argument.
Before writing the real code write the unit test for this. Infact you will be
writing the real code and it's test cases almost in parallel. So just create a
file named `` with just the function definition::

def goodmorning(name):
"This returns a good morning message"

See you are not yet wrote the logic yet. But this is necessary to run tests
successfully with failures!. Ok, now create a file named `example1.txt`
with test cases, use ReStructuredText format::

These are test for `example1` module.

First import the module::

>>> import example1

Now call the function `goodmorning` with out any argument::

>>> example1.goodmorning()
Traceback (most recent call last):
TypeError: goodmorning() takes exactly 1 argument (0 given)

Now call the function `goodmorning` with one argument::

>>> example1.goodmorning('Jack')
'Good morning, Jack!'

See the examples are written like executed from prompt. You can use your
python prompt and copy paste from there. Now create another file
`` with this content::

import unittest
import doctest

def test_suite():
return unittest.TestSuite((

if __name__ == '__main__':

This is just a boilerplate code for running the test. Now run the test using
`python2.4` command.
You will get output with following text::

File "example1.txt", line 16, in example1.txt
Failed example:
'Good morning, Jack!'
Got nothing

Now one test failed, so implement the function now::

def goodmorning(name):
"This returns a good morning message"
return "Good morning, %s!" % name

Now run the test again, it will run without failures.

Now start thinking about other functionalities required for the module. Before
start coding write about it in text file. Decide API, write test, write code,
than continue this cycle untill you finish your requirements.

Monday, September 18, 2006

Python talk on SFD (2)

Promode has written a good blog entry here: . As he said, my intention was to
motivate the engineering students to learn Python. I got around 90 minutes.
Promode's talk was also included lots of Python, because Python is used in
Phoenix ( It was a really interesting talk,
event hough electronics was not my area of interest, I really enjoyed it.

I welcome all those who attended this talk to Kerala Python User Group, more
details are here:

Hmm.. I mentioned Zope 3 too :)

Saturday, September 16, 2006

Python talk on SFD

Today I had one Talk on Python at Vidya academy:
I am writing this from their library. Now helping them to install Koha.
This is my first Python talk, will write details tomorrow.

Friday, September 15, 2006

Sqlite usage

This is a simple tutorial(?) to use sqlite. I used pysqlite 1.0.1 in Python 2.3,
which is the default in Debian 3.1 (Sarge).

The latest pysqlite version is 2.3.2, Visit this site for more info:

""" sqlite module usage with examples

First import sqlite::

>>> import sqlite

Create a temporary directory::

>>> import tempfile
>>> tempdir = tempfile.mkdtemp()

Now create a db file::

>>> import os
>>> dbfile = os.path.join(tempdir, 'testdb.sdb')

Now connect to db and create a cursor::

>>> conn = sqlite.connect(dbfile)
>>> cr = conn.cursor()

Create a table::

>>> cr.execute("CREATE TABLE first_table (a INT)")

Insert a value and get::

>>> cr.execute("INSERT INTO first_table (a) values (1)")
>>> cr.execute("SELECT a FROM first_table")
>>> cr.fetchall()

Test commit and rollback::

>>> conn.commit()
>>> cr.execute("DELETE FROM first_table")
>>> cr.execute("SELECT a FROM first_table")
>>> cr.fetchall()
>>> #now rollback and query again
>>> conn.rollback()
>>> cr.execute("SELECT a FROM first_table")
>>> cr.fetchall()

Insert more values as parameters::

>>> cr.execute("CREATE TABLE second_table (a INT, b VARCHAR(20))")
>>> cr.execute("INSERT INTO second_table (a, b) VALUES (%s, %s)",
... (1, 'hi1'))
>>> cr.execute("SELECT a, b FROM second_table")
>>> cr.fetchone()
(1, 'hi1')

Insert more values using executemany::

>>> cr.executemany("INSERT INTO second_table (a, b) VALUES (%s, %s)",
... [(2, 'hi2'), (3, 'hi3')])
>>> cr.execute("SELECT a, b FROM second_table")
>>> rst = cr.fetchall()
>>> (2, 'hi2') in rst
>>> (3, 'hi3') in rst

Hmm.. there is no rewind::

>>> cr.rewind
Traceback (most recent call last):
AttributeError: rewind

Views are supported::

>>> cr.execute("CREATE VIEW first_second_view \
AS SELECT a.a AS a1, b.a AS a2, b.b \
FROM first_table AS a LEFT JOIN second_table AS b \
ON a.a = b.a")
>>> cr.execute("SELECT a1, a2, b FROM first_second_view")
>>> cr.fetchone()
(1, 1, 'hi1')

Cleanup tempdir::

>>> import shutil
>>> shutil.rmtree(tempdir)


def _test():
import doctest
return doctest.testmod()

if __name__ == '__main__':

Monday, September 4, 2006


Yet another Onam [1] is reached here. Tomorrow is Thiruvonam.
Happy Onam to all my journal vistors!


Friday, September 1, 2006

A nice article by Joe Gregorio

I came across this article today:
"Python isn't just Java without the compile"

Saturday, August 19, 2006

Why I am biased?!

I was always biased towards many technologies. My favourite programming
language is Python, My favourite GUI toolkit is PyGTK. My favourite editor is
GNU Emacs. And my favourite web framework is Zope 3.

But I think I have to look into django now, because of these posts:

BTW, Zope 3.3 is coming: . Now I am a Zope 3
developer, want to learn the internals for contributing, only few minor commits
so far. I managed to create this page:

Sunday, July 23, 2006

Emacs 22, Sunday, GNOME, Plone ...

Now I am posting this from Emacs 22 for a test (cvs version).

And yet another working Sunday :)

Just helped to create this page:
There was lots of help (mainly from #plone irc channel)

BTW, I found this blog by Jon Stahl, very interesting
"Plone and Zope Security"

CMS for GNOME, Why not Plone?

Are you a Plone and GNOME user, then why not just
help GNOME to choose Plone.
See GNOME's CMS requirements here:
Also make this page complete (not just complete, but the *best*)

Thursday, July 6, 2006

Two old batchmates

Recently I met two of my batchmates from NITC
( in different ways.
They are 'hackers' and I learned a lot from them.
Their blogs and journals are also cool:

Thursday, June 29, 2006

I want to write something...

Hmm... what to write now. Let me try to recollect today's journey. Yeah, as
usual, nothing special to remember. I think I woke up at around 5.00 AM, it
was heavily raining outside. I didn't got up from bed, I think I slipped to
sleep again. Then at 5.40 AM my alarm rung, since it was still raining.. oh!
there was some other reason.. well anyway I didn't got up again :) . I used to
go for morning walk at this time, these days it was becoming a routine. May be
I am afraid of my growing abdomen/belly :) . At 8.05 AM I was in bus, then the
same route. Well.. I think I cannot narrate even one day :) . Anyway I will
try again :)

Hmm.. writing something personal is very difficult task. Sometimes I used to
go through some personal blogs, I used to wonder how they write about their
life! Yes! it is not an easy task, only very simple minded peoples can do it,
so I am not :) . Writing someting technical is not that difficult, only thing
is that, we should know the subject.

May be I will stop now :)

Monday, June 19, 2006

My first Zope 3 article

I wrote this Zope 3 introductory tutorial in October 2005.
It was the most popular zope3 tag in from October 2005
to this month (June 2006).
Also there was a good amount of hits too.

I am thankful to Philipp von Weitershausen for adding this to
And Jeffrey Shell for writing about this in

Here is some other Zope 3 tutorials:

Wednesday, June 7, 2006

Kerala Python User Group

In 2004, we started "Kerala Python User Group".
But it was inactive for a long time. Now I am thinking to
re-activate it. Python users are welcome to this group.

These are my ideas about this group:

1. Discuss anything related to Python
2. Python advocacy in Kerala
3. Conduct Python Workshops/conferences
4. Help developing Python/Python modules
5. Create a yet another resource site

You can read about Kerala here:

Thursday, May 25, 2006

Functional/Acceptance Testing Using guitest


guitest ( by Gintautas Miliauskas is a helper
library for unit-testing GUI applications written in Python. In this article I
will demonstrate how to test a PyGTK application. This article assume you are
familiar with ``unittest`` module and unit testing.


The latest version 0.3.1 released on 2005-11-26 is available from here: . Invoke `python
install` to install the library into the local python's site-packages
directory. Alternatively you may simply copy the guitest subdirectory to your
project's main source directory.

Getting Started

Consider this example ::

import gtk

class HelloWorld(object):

def __init__(self):
self.window = gtk.Window()
self.button = gtk.Button("Hello")

def main(self):

if __name__ == '__main__':
helloworld = HelloWorld()

Now think what are the things you have to test. Let's say you want to make
sure that button is a child of window. And you want to test the label of
button is "Hello".

Just look in to this code, should be very easy to understand. ::

import unittest
import gtk
from guitest.gtktest import GtkTestCase

import hello1

class TestHelloWorld(GtkTestCase):

def test_simple_run(self):
helloworld = hello1.HelloWorld()

def test_button(self):
helloworld = hello1.HelloWorld()
button = helloworld.window.get_child()
assert type(button) == gtk.Button

def test_button_text(self):
helloworld = hello1.HelloWorld()
button = helloworld.window.get_child()
assert button.get_label() == "Hello"

def test_suite():
suite = unittest.TestSuite()
return suite

if __name__ == '__main__':

The test case class is inheriting from ``GtkTestCase``. `test_simple_run` is
just running the app. Other two test cases are self explanatory, yes! you
should be familiar with gtk api, that's all.

When testing gui, dialog handlers will be very usefull. We will extend the
first example::

import gtk

class HelloWorld(object):

def __init__(self):
self.window = gtk.Window()
self.button = gtk.Button("Hello")
self.button.connect("clicked", self.on_button_clicked)

def on_button_clicked(self, *args):
dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_INFO, gtk.BUTTONS_OK)
ret =
return ret

def main(self):

if __name__ == '__main__':
helloworld = HelloWorld()

Here is setting a dialog handler for 'Hello' button and testing the label text::

import unittest
import gtk
from guitest.gtktest import GtkTestCase, guistate

import hello2

class TestHelloWorld(GtkTestCase):

def test_button_clicked(self):
helloworld = hello2.HelloWorld()
button = helloworld.button
guistate.dlg_handler = self.handle_hello_clicked

def handle_hello_clicked(self, dlg, *args):
label = dlg.label
if label.get_label() == "OK":
return gtk.RESPONSE_OK
else:"Label is not 'OK'")

def test_suite():
suite = unittest.TestSuite()
return suite

if __name__ == '__main__':

For experimenting this code, just change the assertion, 'label.get_label() ==
"OK"'. If there is another dialog box coming after 'OK' button clicked, you
can add a new handler inside `handle_hello_clicked` function. For example::

def handle_hello_clicked(self, dlg, *args):
label = dlg.label
if label.get_label() == "OK":
guistate.dlg_handler = self.handle_ok_clicked
return gtk.RESPONSE_OK
else:"Label is not 'OK'")

Tuesday, May 23, 2006

What to write?!

For the last one month I didn't wrote anything here.
I have always wondered how some peoples write long
matters in journal/blog. Is it just like composing
reply to a technical mail. Do they feel the pain
of creativity. I usually read python, gnome and ubuntu
planets. I like new ideas in programming, technology
also I read humor and philosophy. I think most of the
planets didn't restrict topics. Some of them writes
highly technical stuff only, some writes about life
some writes what's happening everywhere else.
Well, it is something like this, a type is declared
"int me1;", "float me2;". Yes some people sometimes
upcast or downcast their values :)
And there are few dynamically typed journals/blogs
and I like those very much, the first example
I can point is Guido's blog
So a "Pythonic blog is always dynamically typed" :)
What is your favorite dynamically typed blog/journal?

Tuesday, April 18, 2006

Characters per line for technical documentations

I was wondering what will be the best choice for the number of
characters per line for text based technical documentations.

Well, better to reduce the scope of question. Ok, let it be a
documentation for Python package/product written using

My choice is now 80 characters. Any reason to reduce that
or not use a character limit at all?

Python PEPs are using 72 characters, is there any style
recommendation from Python coding or other standards?

I started thinking about this from

Tuesday, March 21, 2006

Fortnightly Zope Newsletter

I think Michael Haubenwallner has silently announced
a "Fortnightly Zope Newsletter"
This is available from here:

This is really content rich and great looking!
Kudos to all those who worked behind this.

Friday, March 10, 2006

Creating a hello world is really easy in Zope 3!

Yes! compared to any other Python/Non-Python frameworks,
creating a hello world is really easier in Zope 3.

See this:

So Zope 3 can scale down to anything :)

Monday, January 16, 2006

A test post, my first post to planet!

I am Baiju M from Kerala (
A relatiely new Python programmer, hmm.. now two years :)
I am working for a small company based in Calicut,
before one and half years (when I joined here) our
main language was VB. Now for almost all projects we are using
Python, now we are Python Powerd! . For our GUI apps we are using
PyGTK and for web we decided to use Zope3 (not yet started though).
I hope this is enough for now.