User-defined Exceptions: is self.args OK?

2008-04-16 Thread petr . jakes . tpc
Hi, I am trying to dig through User-defined Exceptions (http:// docs.python.org/tut/node10.html chapter 8.5) is it OK to add following line to the __init__ method of the TransitionError class? self.args = (self.previous, self.next, self.message) If I do not add this argument to the clas

Re: SQL problem in python

2008-03-08 Thread petr . jakes . tpc
Maybe you should try SQLObject :-) from sqlobject import * from sqlobject.sqlbuilder import Select #from sqlobject.sqlbuilder import * from datetime import datetime # === sqlite == #connection = connectionForURI('sqlite:///dev/shm/ourdata.db') connection = conne

Re: looking for a light weighted library/tool to write simple GUI above the text based application

2008-03-07 Thread petr . jakes . tpc
Finaly, after few experiments, I am using pygame. It comunicates directly with the framebuffer and the performance is excellent. Thanks for your help. Petr Jakes -- http://mail.python.org/mailman/listinfo/python-list

Re: Data aggregation

2008-03-06 Thread petr . jakes . tpc
On Mar 6, 7:44 pm, John Nagle <[EMAIL PROTECTED]> wrote: > vedranp wrote: > > I would like to avoid the step of taking data out from database in > > order to process it. > > You can probably do this entirely within SQL. Most SQL databases, > including MySQL, will let you put the result of a SE

property data-descriptor - how to pass additional constants to the get/set method

2008-02-25 Thread petr . jakes . tpc
Hi, I would like to pass additional constants to the property data- descriptor, so it is not necessary to write many methods which differ just by constant defined in the method body. Till now I can do this: class MyClass(object): def _getValue(self, myConstant): print 'myConstant:', m

Re: looking for a light weighted library/tool to write simple GUI above the text based application

2008-01-25 Thread petr . jakes . tpc
> I agree that SDL is probably the best choice but for the sake of > completeness, Gtk can (at least in theory - I've never tried it) be > built against directfb and run without X. from the Pygame Introduction: Pygame is a Python extension library that wraps the SDL library and it's helpers. So y

Re: looking for a light weighted library/tool to write simple GUI above the text based application

2008-01-25 Thread petr . jakes . tpc
> > is already solved). > > what you are looking for is curse :) > http://docs.python.org/lib/module-curses.html > http://www.ibm.com/developerworks/linux/library/l-python6.html > > renaud Renaud, thanks for your reply. I think I was not specific/clear enough in my first posting. I know the curse

looking for a light weighted library/tool to write simple GUI above the text based application

2008-01-25 Thread petr . jakes . tpc
Hi, I am working with the Python 2.5 running on the command line version of Linux Ubuntu 7.04. This means NO X-windows, NO GTK/Gnome, NO computer mouse, on my machine (AMD Geode 500MHz CPU, VGA output). I would like to write some really light weighted GU interface. My concept is to have just few u

Re: Pivot Table/Groupby/Sum question

2008-01-04 Thread petr . jakes . tpc
On Jan 4, 4:55 pm, [EMAIL PROTECTED] wrote: > Petr thanks so much for your input. I'll try to learnSQL, especially > if I'll do a lot of database work. > > I tried to do it John's way as en exercise and I'm happy to say I > understand a lot more. Basically I didn't realize I could nest > dictiona

Re: Pivot Table/Groupby/Sum question

2008-01-03 Thread petr . jakes . tpc
On Jan 3, 3:41 pm, [EMAIL PROTECTED] wrote: > Yes in the sense that the top part will have merged cells so that > Horror and Classics don't need to be repeated every time, but the > headers aren't the important part. At this point I'm more interested > in organizing the data itself and i can worry

Re: Pivot Table/Groupby/Sum question

2008-01-02 Thread petr . jakes . tpc
> So the data comes in as a long list. I'm dealing with some > information on various countries with 6 pieces of information to > pivot. Just to make it simple it's like a video store database. The > data is like [Country, Category, Sub Category, Film Title, Director, > Number of Copies]. data

Re: Newbie: Why doesn't this work

2008-01-01 Thread petr . jakes . tpc
Steven, thanks for a nice explanation. I am trying to experiment a little bit with new-style class and I am confused why following example always returns 0 (zero). I was expecting will return values from 0 to 9 and finaly an Exception. class GenExample(object): def getInfo(self): fo

Re: Newbie: Why doesn't this work

2008-01-01 Thread petr . jakes . tpc
> > My question is: is it possible to set the "property" for any attribute > > when I do not know what will be the name of the attribute in the > > future? > > Uhm... I don't understand the question. Perhaps if you think of a concrete > case...? Thanks for reply, few minutes after i posted my que

Re: Newbie: Why doesn't this work

2008-01-01 Thread petr . jakes . tpc
Hi all, I am trying to understand new-style classes in Python and I have found your postings here. Gabriel, if I understand it properly, it is necessary to define get/ set/del/doc methods for each attribute for which I want to set the "property" data descriptor (which triggers get/set/del/doc fun

Re: Pivot Table/Groupby/Sum question

2007-12-29 Thread petr . jakes . tpc
> Yes, I realize Excel has excellent support for pivot tables. However, > I hate how Excel does it and, for my particular excel files, I need > them to be formated in an automated way because I will have a number > of them over time and I'd prefer just to have python do it in a flash > than to do

Re: Pivot Table/Groupby/Sum question

2007-12-29 Thread petr . jakes . tpc
Patrick, in your first posting you are writing "... I'm trying to learn how to make pivot tables from some excel sheets...". Can you be more specific please? AFIK Excel offers very good support for pivot tables. So why to read tabular data from the Excel sheet and than transform it to pivot tabel

Re: Pivot Table/Groupby/Sum question

2007-12-28 Thread petr . jakes . tpc
What about to let SQL to work for you. HTH Petr Jakes Tested on Python 2.5.1 8<-- #!/usr/bin/env python # -*- coding: utf-8 -*- import sqlite3 con = sqlite3.connect(":memory:") cur = con.cursor() inputData=( ('Bob', 'Morn', 240), ('Bob', 'Aft', 300), ('Joe', 'Morn', 70), ('

Re: how to generate html table from "table" data?

2007-12-26 Thread petr . jakes . tpc
Dennis, Thank you very much for your code snippet. I will try to install CherryTemplate and use it. I did not work with any template tool before and I am not the * class programmer as other people here, so my questions maybe look "strange" or "stup..". I didn't mean to offend somebody here an

Re: how to generate html table from "table" data?

2007-12-26 Thread petr . jakes . tpc
> > Why not try writing your own code for this first? > If nothing else, it'll help you learn more, and may also help you > understand better, the other options. > > Vasudev Ram Thanks for your reply even it was not really helpful. Of course some attempts to generate html from tabular data are beh

how to generate html table from "table" data?

2007-12-25 Thread petr . jakes . tpc
Hi group, I would like to convert the output of the SQL query, or more generally I would like to convert any "table" data to the html table. I would like to set some rules to format cells, columns or rows (font, colour etc.) of the html table, according to the values in the specific cells. Googl

Re: doctest + sqlobject (TDD)

2007-12-22 Thread petr . jakes . tpc
Thanks, it works. And thanks for your comments which are worth to think about :) Petr > This has nothing to do with your previous problem. Use > > from __main__ import myFunction, myOtherFunction, ... > > or > > from __main__ import * > > if you prefer "namespace pollution paradise"*. > > Again, i

Re: doctest + sqlobject (TDD)

2007-12-22 Thread petr . jakes . tpc
On Dec 22, 7:05 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > petr.jakes.tpc wrote: While you could either alter the textfile to > > >>> import __main__ as displeje_pokus > > or the module along the lines of > > # not recommended! > from displeje_pokus import TextyDispleje > if __name__ == "__main__

doctest + sqlobject (TDD)

2007-12-22 Thread petr . jakes . tpc
Hi, inspired by the article written by Tarek Ziade in the February 07 issue of the "Linux +" magazine I am experimenting with the doctest module. I have two files, "displeje_pokus.py" and "displeje_pokus.txt" (you can see the simplified contents of the files bellow). When I run "python displeje_