Re: [Tutor] Extract Block of Data from a 2D Array

2017-03-31 Thread Karim
all columns. The csv module allows you to to easily reference the element of each column with its column name (given by the header == the first line of the file) Cheers Karim ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Working with prime numbers

2015-01-10 Thread Karim
On 08/01/2015 06:25, Steven D'Aprano wrote: Sieve of Eratosthenes Very cool I will use it. Karim ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] xlrd package

2014-04-26 Thread Karim
On 26/04/2014 10:43, Alan Gauld wrote: On 26/04/14 05:48, Sunil Tech wrote: I want to know how many sheets can be created in Excel using xlrd package. This list if for people learning the Python language and standard library. xlrd is not part of that so you may have more success asking on

Re: [Tutor] implementing rot 13 problems

2013-03-12 Thread Karim
What can be said after this detailed lesson...Bravo! On 12/03/2013 11:58, Steven D'Aprano wrote: On 12/03/13 16:57, RJ Ewing wrote: I am trying to implement rot 13 and am having troubles. My code is as follows: A few comments follow. def rot_text(self, s): ls = [i for i in s]

Re: [Tutor] How to run multiline shell command within python

2013-01-10 Thread Karim
On 10/01/2013 16:21, Matty Sarro wrote: Have you looked a the pexpect class? It works like gangbusters, especially if you're trying to run something with an interactive shell. http://www.noah.org/wiki/pexpect On Thu, Jan 10, 2013 at 9:25 AM, Karim <mailto:kliat...@gmail.com>> w

Re: [Tutor] How to run multiline shell command within python

2013-01-10 Thread Karim
On 10/01/2013 09:31, Hugo Arts wrote: On Thu, Jan 10, 2013 at 7:01 AM, Karim <mailto:kliat...@gmail.com>> wrote: Hello all, I want to run multiline shell command within python without using a command file but directly execute several lines of shell. I al

[Tutor] How to run multiline shell command within python

2013-01-09 Thread Karim
l lines of code directly. Example: cat< myfile echo "foo" echo "bar" ... EOF Regards Karim ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] Problem with mechanize and forms

2012-04-14 Thread Karim Gorjux
ny of these forms! I need the first form so I tried br.select_form(nr=0) but I get None! Any number I tried get None as result for i in range(6): print br.select_form(nr=i) None None None None None None Anyone can help me? Thanks -- Karim Gorjux __

Re: [Tutor] How to have the name of a function inside the code of this function?

2012-04-06 Thread Karim
Le 07/04/2012 04:01, Dave Angel a écrit : On 04/06/2012 03:19 PM, Karim wrote: Le 06/04/2012 19:31, Alan Gauld a écrit : On 06/04/12 09:47, Karim wrote: If you have any idea to get the caller name inside the caller. Its not normally very helpful since in Python the same function can have

Re: [Tutor] How to have the name of a function inside the code of this function?

2012-04-06 Thread Karim
Le 06/04/2012 19:31, Alan Gauld a écrit : On 06/04/12 09:47, Karim wrote: If you have any idea to get the caller name inside the caller. Its not normally very helpful since in Python the same function can have many names: def F(x): return x*x a = F b = F c - lambda y: F(y) print F(1

[Tutor] How to have the name of a function inside the code of this function?

2012-04-06 Thread Karim
me. This is not more helpful ;o) If you have any idea to get the caller name inside the caller. Cheers Karim ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Using __ini__.py for common fonctions

2012-02-14 Thread Karim
Le 14/02/2012 20:25, Alan Gauld a écrit : On 14/02/12 19:08, Karim wrote: Advices are welcome! Asking the same question twice does not double your chances of getting a reply. It may even reduce them. As to your question, it's not the most common way to do it, it's not even t

[Tutor] Using __ini__.py for common fonctions

2012-02-14 Thread Karim
Hello All, I have 3 functions, common utilities which I use several times in many modules of a main package. I don't want to create an utilies.py module in the package. Instead I declare it in the __init__.py of the package. Then to use it I do the following: from packe Is it ok to do thi

[Tutor] Using __ini__.py for common fonctions

2012-02-14 Thread Karim
from package import my_common_utility_fonction. Is it ok to do this? Is it a common practise? Advices are welcome! Cheers Karim ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] creating a pie chart in Python

2011-12-07 Thread Karim
n.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor With tkinter I made one time a chart so check to be able to do pie one. Another solution is to use pychart cf link below: http://home.gna.org/pychart/ cheers Karim _

Re: [Tutor] How to raise error without the stack trace

2011-11-27 Thread Karim
Le 26/11/2011 15:20, Rich Lovely a écrit : On 26 November 2011 11:41, Steven D'Aprano wrote: Hugo Arts wrote: On Sat, Nov 26, 2011 at 11:16 AM, Karim wrote: Hello, I want to fire my own exception without having the (useful but ugly in my case) stack trace display. How to mod

[Tutor] How to raise error without the stack trace

2011-11-26 Thread Karim
Hello, I want to fire my own exception without having the (useful but ugly in my case) stack trace display. How to modify a Exception type class for that purpose which looks like: classs MyError(Exception): pass Cheers Karim ___ Tutor

Re: [Tutor] basic class loading question

2011-11-24 Thread Karim Meiborg
Cranky Frankie wrote: > OK, but this is still not working: > > class Qb: > def __init__(self, first_name='', last_name='', phone='', > email='', stadium=''): > self.first_name = first_name > self.last_name = last_name > self.phone = phone > self.email = email >

[Tutor] Template class and class design on concrete example xl2csv writer

2011-11-23 Thread Karim
tern which usually goes with the Template pattern. Except from that all better design or others critics will be welcome. Regards karim ___ from __future__ import p

Re: [Tutor] Please code review.

2011-08-02 Thread Karim
On 08/02/2011 03:59 PM, Peter Otten wrote: Karim wrote: values = ( (22.5,21.5,121.5), (5615.3,615.3,-615.3), (-2315.7,315.7,415.7) ) it = _xrange_cellnames(rows=len(value), cols=len(values[0])) table.getCellByName(it.next()).setValue(22.5) table.getCellByName(it.next()).setValue(5615.3

Re: [Tutor] Please code review.

2011-08-02 Thread Karim
Thanks Martin, This is the generator expression version. I can use both function generator or generator expression version correction. Cheers Karim On 08/02/2011 02:47 PM, Martin Gracik wrote: def get_cellnames2(rows, cols): rows = range(1, rows + 1) cols = string.ascii_uppercase

[Tutor] Please code review.

2011-08-02 Thread Karim
Hello, I need a generator to create the cellname in a excell (using pyuno) document to assign value to the correct cell. The following code does this but do you have some optimizations on it, for instance to get the alphabetic chars instead of hard-coding it. Cheers karim Python 2.7.1

Re: [Tutor] Urllib Problem

2011-07-29 Thread Karim
adlines() for i in x: urllib.request.openurl('www.google.gr/ <http://www.google.gr/>' + i) But it doesent work.Whats the problem? Please give the exception error you get?! And you should have in the html header the html code error number which gives you the fail a

[Tutor] Is it bad practise to write __all__ like that

2011-07-28 Thread Karim
Hello, __all__ = 'api db input output tcl'.split() or __all__ = """ api db input output tcl """.split() for lazy boy ;o). It is readable a

Re: [Tutor] shlex parsing

2011-07-27 Thread Karim
On 07/28/2011 02:27 AM, Steven D'Aprano wrote: Karim wrote: Hello All, I would like to parse this TCL command line with shlex: '-option1 [get_rule A1 B2] -option2 $VAR -option3 TAG' And I want to get the splitted list: ['-option1', '[get_rule A1 B2]&#x

Re: [Tutor] Fall in love with bpython

2011-07-27 Thread Karim
On 07/28/2011 01:32 AM, Walter Prins wrote: Hi Karim On 28 July 2011 00:04, Karim <mailto:karim.liat...@free.fr>> wrote: On 07/27/2011 12:34 AM, Alan Gauld wrote: Karim wrote: I use bpython interpreter. This is a very good interactive CLI.

Re: [Tutor] Fall in love with bpython

2011-07-27 Thread Karim
it as well. Cheers Karim Michael * Karim [2011-07-27 23:46]: Hello, I use bpython interpreter. This is a very good interactive CLI. I want to create a CLI with the same features than bpython. But the cmd std module seems no to be used in this project... Is there a tool where I can plug a

Re: [Tutor] Fall in love with bpython

2011-07-27 Thread Karim
On 07/27/2011 12:34 AM, Alan Gauld wrote: Karim wrote: I use bpython interpreter. This is a very good interactive CLI. I had never heard of it and had to google for it. It appears to be a curses based CLI for *nix and MacOS Ah Windows user. I want to create a CLI with the same features

Re: [Tutor] shlex parsing

2011-07-27 Thread Karim
using pyParsing still be easer. Thanks Cheers On Wed, Jul 27, 2011 at 2:08 PM, Karim <mailto:karim.liat...@free.fr>> wrote: Thank you Dan for answering. I ended with this and gave up with shlex: split = ['-option1', '[get_rule', 'A1', &

[Tutor] Fall in love with bpython

2011-07-27 Thread Karim
, highlights, etc... Cheers Karim ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] shlex parsing

2011-07-27 Thread Karim
, '$VAR', '-option3', 'TAG'] ['-option1', '[get_rule A1 B2]', '-option2', '$VAR', '-option3', 'TAG'] Sure pyParsing seems to be pretty simple but my constraint is to use standard lib (at maximum). To bad it is

[Tutor] shlex parsing

2011-07-27 Thread Karim
TAG'] Then I will gather in tuple 2 by 2 the arguments. I tried to the shlec properties attributes 'quotes', 'whitespace', etc... But I make 'choux blanc'. If somebody has complex experiences with this module I am in. Cheers Karim _

Re: [Tutor] Strategy to read a redirecting html page

2011-06-01 Thread Karim
On 06/01/2011 01:41 AM, Alexandre Conrad wrote: Hi Karim, When you hit the page and you get an HTTP redirect code back (say, 302), you will need to make another call to the URL specified in the "Location" parameter in the response headers. Then you retrieve that new page and you can

[Tutor] Strategy to read a redirecting html page

2011-05-31 Thread Karim
you have a better strategy or perhaps some modules deal w/ that issue? I am using python 2.7.1 on Linux ubuntu 11.04 and the modules urllib2, urllib, etc... The webpage is secured but I registered a password manager. cheers karim ___ Tutor maillist

Re: [Tutor] Writing OpenOffice/LibreOffice doc with python

2011-05-19 Thread Karim
On 05/19/2011 10:57 PM, Karim wrote: Hello All, Is it possible to write document in ODP or DOC format with a python API? Do you know an easy one and popular one which works with python 2.7.1? Cheers Karim ___ Tutor maillist - Tutor@python.org To

[Tutor] Writing OpenOffice/LibreOffice doc with python

2011-05-19 Thread Karim
Hello All, Is it possible to write document in ODP or DOC format with a python API? Do you know an easy one and popular one which works with python 2.7.1? Cheers Karim ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription

Re: [Tutor] What is the trick ???!

2011-05-12 Thread Karim
On 05/12/11 21:24, Karim wrote: Hello See below, I was surprised about finding hidden function in module sys: karim@Requiem4Dream: python2.7 Python 2.7.1rc1 (r271rc1:86455, Nov 16 2010, 21:53:40) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or

[Tutor] What is the trick ???!

2011-05-12 Thread Karim
Hello See below, I was surprised about finding hidden function in module sys: karim@Requiem4Dream: python2.7 Python 2.7.1rc1 (r271rc1:86455, Nov 16 2010, 21:53:40) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license&qu

Re: [Tutor] Generating XML using Python

2011-04-11 Thread Karim
On 04/11/2011 07:50 PM, Karim wrote: On 04/11/2011 10:04 AM, tee chwee liong wrote: hi Peter, thanks for your reply. seems that xml doesnt accept a space in between. anyway, the output generated is: *-* *-* ** *2* ** *3* ** ** it overwrites every time the port number is incremented

Re: [Tutor] Generating XML using Python

2011-04-11 Thread Karim
On 04/11/2011 10:04 AM, tee chwee liong wrote: hi Peter, thanks for your reply. seems that xml doesnt accept a space in between. anyway, the output generated is: *-* *-* ** *2* ** *3* ** ** it overwrites every time the port number is incremented and only capture the last iteration numb

Re: [Tutor] How to use a module when only import package

2011-04-08 Thread Karim
n/listinfo/tutor Hello, Test it simply! You will get answer in 3 seconds. ;o) Regards Karim ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Finding prime numbers script runs much faster when run via bash shell than idle

2011-04-01 Thread Karim
ter += 1 And IDLE adds a layer due to the interactive feature to display result. It is python interpreter plus Tk layer. Just a thought nothing truly precise. Regards Karim ___ Tutor maillist - Tutor@python.org To unsubscribe or change subsc

Re: [Tutor] Finding prime numbers script runs much faster when run via bash shell than idle

2011-04-01 Thread Karim
nter += 1 And IDLE add a layer due to the interactive feature to display result. It is python interpreter plus Tk layer. Just a thought nothing truly precise. Regards Karim ___ Tutor maillist - Tutor@python.org To unsubscribe or change subsc

Re: [Tutor] counting a list of elements

2011-04-01 Thread Karim
On 04/02/2011 07:00 AM, Knacktus wrote: Am 01.04.2011 21:31, schrieb Karim: On 04/01/2011 08:41 PM, Knacktus wrote: Am 01.04.2011 19:16, schrieb Karim: Hello, I would like to get advice on the best practice to count elements in a list (built from scractch). The number of elements is in the

Re: [Tutor] Meta language and code generation

2011-04-01 Thread Karim
On 04/02/2011 06:38 AM, Knacktus wrote: Am 01.04.2011 20:56, schrieb Karim: On 04/01/2011 08:29 PM, Knacktus wrote: Am 01.04.2011 19:09, schrieb Karim: Hello All, I would to ask you if somebody has experience or can give direction in a new project I have. I have a meta language

Re: [Tutor] counting a list of elements

2011-04-01 Thread Karim
On 04/01/2011 08:41 PM, Knacktus wrote: Am 01.04.2011 19:16, schrieb Karim: Hello, I would like to get advice on the best practice to count elements in a list (built from scractch). The number of elements is in the range 1e3 and 1e6. 1) I could create a generator and set a counter (i +=1

Re: [Tutor] Meta language and code generation

2011-04-01 Thread Karim
On 04/01/2011 08:29 PM, Knacktus wrote: Am 01.04.2011 19:09, schrieb Karim: Hello All, I would to ask you if somebody has experience or can give direction in a new project I have. I have a meta language description (in xml) from which I should generate code on different languages. In my case

[Tutor] counting a list of elements

2011-04-01 Thread Karim
list, indeed, in term of memory I don't want to wast it. But I suppose len() is optimized too (C impementation). If you have some thought to share don't hesitate. Karim ___ Tutor maillist - Tutor@python.org To unsubscribe or change subsc

[Tutor] Meta language and code generation

2011-04-01 Thread Karim
appreciated! Kind Regards Karim ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] argparse csv + choices

2011-04-01 Thread Karim
gs = csv.split(',') remainder = sorted(set(args) - set(self.choices)) if remainder: raise ValueError("invalid choices: %r (choose from %r)" % (remainder, self.choices)) return args except ValueError, e: raise argparse.ArgumentTypeError(e) Regards Karim ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Accessing query results html frame :The solution

2011-02-16 Thread Karim
On 02/16/2011 08:40 AM, Karim wrote: On 02/14/2011 01:41 PM, Karim wrote: Hello, As I get no response from the tutor python list, I am continuing to investigate my problem. In fact the issue is that there are 2 forms in the interactive page and my request does nothing instead I get the

Re: [Tutor] Creating xml documents

2011-02-15 Thread Karim
Hello, It seems stefan that version 1.3 still does not validate xml against xsd... Reg On 02/15/2011 02:48 PM, Stefan Behnel wrote: allan oware, 15.02.2011 14:31: Which python modules can one use to create nicely formatted xml documents ? Depends on your exact needs, but xml.etree.ElementT

Re: [Tutor] Creating xml documents

2011-02-15 Thread Karim
Hello, It seems stefan that version 1.3 still does not validate xml against xsd... Reg On 02/15/2011 02:48 PM, Stefan Behnel wrote: allan oware, 15.02.2011 14:31: Which python modules can one use to create nicely formatted xml documents ? Depends on your exact needs, but xml.etree.ElementT

Re: [Tutor] How to run another python script?

2011-02-14 Thread Karim
Better way is to not have BBB but simply to use Exception (pseudo-code): try: ... catch IOError, e: print("Error encountered in generating zip file:", e) else: import os os.remove('') Regards Karim On 02/14/2011 05:04 PM, Karim wrote: On 02/14/2011 04:

Re: [Tutor] How to run another python script?

2011-02-14 Thread Karim
end. One possibility: exec( "/BBB" ) Or make import of BBB module as below: from BBB import main BBB.main() Regards Karim Please let me know How can I call the BBB file from AAA file. Thanks in advance. Dan ___ Tutor maillist -

Re: [Tutor] Accessing query results html frame

2011-02-10 Thread Karim
x27;rightframe'. Any ideas how I can modified the code (I think the request data or whatever) below to access without knowing the temporary html file name generically. Regards Karim On 02/10/2011 07:12 PM, Karim wrote: Hello All, I get from Steven an very useful link (void space) for http

[Tutor] Accessing query results html frame

2011-02-10 Thread Karim
Hello All, I get from Steven an very useful link (void space) for http authentication. I added some codes to be able to POST FORM a query as I do it by clicking a query button to get a list of bug Id on a server. The problem is I get a html page which refers 2 frames. And I am interesting in

Re: [Tutor] RE module is working ?

2011-02-04 Thread Karim
By the way with your helper function algorithm Steven and Peter comments you made me think of this change: karim@Requiem4Dream:~$ echo 'prima " "' | sed -e 's/""/\\"\\"/g;s/\([^\]\)"/\1\\"/g' prima \" \" karim@Requiem

Re: [Tutor] RE module is working ?

2011-02-04 Thread Karim
On 02/04/2011 11:26 AM, Peter Otten wrote: Karim wrote: That is not the thing I want. I want to escape any " which are not already escaped. The sed regex '/\([^\\]\)\?"/\1\\"/g' is exactly what I need (I have made regex on unix since 15 years). Can the backslash

Re: [Tutor] RE module is working ?

2011-02-04 Thread Karim
On 02/04/2011 02:36 AM, Steven D'Aprano wrote: Karim wrote: *Indeed what's the matter with RE module!?* You should really fix the problem with your email program first; Thunderbird issue with bold type (appears as stars) but I don't know how to fix it yet. A man when to a

Re: [Tutor] RE module is working ?

2011-02-03 Thread Karim
On 02/03/2011 07:47 PM, Karim wrote: On 02/03/2011 02:15 PM, Peter Otten wrote: Karim wrote: I am trying to subsitute a '""' pattern in '\"\"' namely escape 2 consecutives double quotes: * *In Python interpreter:* $ python Python 2.7.1rc1 (r2

Re: [Tutor] RE module is working ?

2011-02-03 Thread Karim
On 02/03/2011 11:20 PM, Dave Angel wrote: On 01/-10/-28163 02:59 PM, Karim wrote: On 02/03/2011 02:15 PM, Peter Otten wrote: Karim wrote: (snip> *Indeed what's the matter with RE module!?* You should really fix the problem with your email program first; Thunderbird issue with b

Re: [Tutor] RE module is working ?

2011-02-03 Thread Karim
On 02/03/2011 02:15 PM, Peter Otten wrote: Karim wrote: I am trying to subsitute a '""' pattern in '\"\"' namely escape 2 consecutives double quotes: * *In Python interpreter:* $ python Python 2.7.1rc1 (r271rc1:86455, Nov 16 2010, 21:53:40) [GCC

Re: [Tutor] RE module is working ?

2011-02-03 Thread Karim
:45 PM, Karim wrote: Hello Steven, I am perhaps a poor tradesman but I have to blame my thunderbird tool :-P . Because expression = *' "" '* is in fact fact expression = ' "" '. The bold appear as stars I don't know why. I need to have escapes for pa

Re: [Tutor] RE module is working ?

2011-02-03 Thread Karim
x27; "" ' >>> re.subn(r'([^\\])?"', r'\1\\"', expression) But if I remove '?' I get the following: >>> re.subn(r'([^\\])"', r'\1\\"', expression) (' \\"" ', 1) * On linux using

Re: [Tutor] RE module is working ?

2011-02-03 Thread Karim
Hello, Any news on this topic?O:-) Regards Karim On 02/02/2011 08:21 PM, Karim wrote: Hello, I am trying to subsitute a '""' pattern in '\"\"' namely escape 2 consecutives double quotes: * *In Python interpreter:* $ python Python 2.7.1rc1 (r2

[Tutor] RE module is working ?

2011-02-02 Thread Karim
copyright", "credits" or "license" for more information. >>> expression = *' "" '* >>> re.subn(*r'([^\\])?"', r'\1\\"', expression*) Traceback (most recent call last): File "", line 1, in File

Re: [Tutor] Formatting a string

2011-02-01 Thread Karim
Complete test copy & paste: karim@Requiem4Dream:~$ python Python 2.7.1rc1 (r271rc1:86455, Nov 16 2010, 21:53:40) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> "He is {what}".fo

Re: [Tutor] Formatting a string

2011-02-01 Thread Karim
Hello, >>> "He is {what}".format(what="{wild}") 'He is {wild}' Regards Karim On 02/01/2011 09:44 AM, Becky Mcquilling wrote: Quick question to the group to solve an immediate problem and then if anyone has a dead simple reference on formatting strings

Re: [Tutor] oops...sorry, just top posted again

2011-01-31 Thread Karim
Is this a SM forum ? Karim On 01/31/2011 04:05 PM, David Hutto wrote: On Mon, Jan 31, 2011 at 8:11 AM, Elwin Estle wrote: ...but I have an excuse. I had the thing saved in a drafts folder and just hit send without thinking about it. ...I'll just go super glue broken glass to my hand

Re: [Tutor] Python and Tuples

2011-01-30 Thread Karim
Hello, for x, y in t: print x*y Regards Karim On 01/30/2011 10:29 AM, Becky Mcquilling wrote: I'm fairly new to python and I am trying to do some math with tuples. If I have a tuple: t =( (1000, 2000), (2, 4), (25, 2)) I want to loop through and print out the results of the multip

Re: [Tutor] Accessing a secured webpage

2011-01-28 Thread Karim
, realm): return self.__user, self.__passwd urlopener = myURLOpener() urlopener.setpasswd("mulder", "trustno1")* Basically, we must subclass **urllib.FancyURLopener** and override **prompt_user_passwd(). **Regards Karim ** ** On 01/28/2011 11:15 PM, ian douglas

Re: [Tutor] Accessing a secured webpage

2011-01-28 Thread Karim
Vince I saw your answer on the related subject fron October 2010 : *Re: [Tutor] Requesting restricted URL (further authentication requested)*. Thanks Karim On 01/28/2011 11:05 PM, Vince Spicer wrote: You may want to look at httplib2 http://code.google.com/p/httplib2/ This great module

[Tutor] Accessing a secured webpage

2011-01-28 Thread Karim
gin and password via python code. The web adress is like http://website.com:8081/ddts/ddts_main. If you have link it is welcome! Regards Karim ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.

Re: [Tutor] small ElementTree problem

2011-01-27 Thread Karim
ent.text) final = zip(ids, names) * You are not obliged to provide the full XPATH. Etree search for you. Regards Karim On 01/27/2011 11:23 PM, Alex Hall wrote: Hi all, I am using, and very much enjoying, the ElementTree library. However, I have hit a problem. Say I have something along the lin

Re: [Tutor] tkinter, create widgets during runtime?

2011-01-27 Thread Karim
Sorry, I forgot to update continuously the Frame: >>> a.mainloop() Karim On 01/27/2011 02:59 PM, Karim wrote: I never did that but this is python! You can create anything you want at runtime! Make a factory method in you gui class which inherit from Frame or whatever container c

Re: [Tutor] tkinter, create widgets during runtime?

2011-01-27 Thread Karim
Sorry, I forgot to update continuously the Frame: >>> app.mainloop() Karim On 01/27/2011 02:59 PM, Karim wrote: I never did that but this is python! You can create anything you want at runtime! Make a factory method in you gui class which inherit from Frame or whatever container c

Re: [Tutor] tkinter, create widgets during runtime?

2011-01-27 Thread Karim
Hello Wayne, I provided a complete example see the mail above, pretty similar to yours. Regards Karim On 01/27/2011 04:54 PM, Wayne Werner wrote: On Wed, Jan 26, 2011 at 11:21 AM, Elwin Estle mailto:chrysalis_reb...@yahoo.com>> wrote: With Tcl/Tk, you can generate widgets "

Re: [Tutor] tkinter, create widgets during runtime?

2011-01-27 Thread Karim
quot;this is label " + labelName)) ... for label in labels: ... label.pack() ... >>> a=gui() >>> a.createLabels() self is the instance of your inherited Frame or else container. Regards Karim On 01/27/2011 01:15 PM, Elwin Estle wrote: From the lack of repli

Re: [Tutor] Print to std output with color

2011-01-26 Thread Karim
That's what I figured out at effbot website. Thanks for the additional link Alan! Regards Karim On 01/26/2011 07:27 PM, Alan Gauld wrote: "Karim" wrote Is there a simple way to print with color to stdout like the unix/linux example below: *print( '^[[1;31mThis is a

Re: [Tutor] Print to std output with color

2011-01-26 Thread Karim
Thanks Alan! I will go there have a look. Regards Karim On 01/26/2011 07:24 PM, Alan Gauld wrote: "Karim" wrote Is there a simple way to print with color to stdout like the unix/linux example below: *print( '^[[1;31mThis is a warning!^[[0m' ) Not generically si

Re: [Tutor] Print to std output with color

2011-01-26 Thread Karim
Thanks a lot Scott for the tip! Regards Karim On 01/26/2011 07:10 PM, Scott Nelson wrote: Curses is one way to go. Another is to use the PyWin32 module discussed in this thread: http://thread.gmane.org/gmane.comp.python.tutor/58450/focus=58454 Basically, here's a snippet of code tha

[Tutor] Print to std output with color

2011-01-26 Thread Karim
ate_output( mode=WARNING, *'This is a warning!')*/_ Regards Karim ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] class question

2011-01-26 Thread Karim
I know the the law of Murphy. But this one is a must-have.:-) Regards Karim * One way to reduce coupling is with the Law of Demeter: if you want your dog to walk, don't talk to your dog's legs. You will only confuse the dog and it won't get anywhere. http://en.wik

Re: [Tutor] class question

2011-01-26 Thread Karim
y has the same style. Regards Karim On 01/26/2011 12:08 PM, Alan Gauld wrote: "Karim" wrote Program towards interface that means you have to use inheritance. Just to be picky, you can program by interface without using inheritance. Inheritance is only needed to implemen

Re: [Tutor] class question

2011-01-25 Thread Karim
. Try to determine the objects you need for your problem and next step is how arrange it together (relational). Regards Karim On 01/26/2011 01:28 AM, Marc Tompkins wrote: On Tue, Jan 25, 2011 at 3:26 PM, Elwin Estle wrote: Is it better to have one large sort of "do it all" class, or

Re: [Tutor] The trap of the year

2011-01-25 Thread Karim
Sorry Alan, When I read your tutorial I was probably blind... :-D I am going to re-read it. Regards Karim On 01/26/2011 01:30 AM, Alan Gauld wrote: "Karim" wrote If I understand a little bit what happen in: def __init__(self, parameters=[]): [...] The list argument is bu

Re: [Tutor] The trap of the year

2011-01-25 Thread Karim
After one 2 months of python intensive development. I made this init defaults error in my db classes constructors... Shame on me :-[ Steven ! Your example shows me obvious. Regards Karim On 01/26/2011 12:33 AM, Steven D'Aprano wrote: Karim wrote: Hello All, Just to share on rageou

Re: [Tutor] The trap of the year

2011-01-25 Thread Karim
Thanks for the tip Steven. Regards Karim On 01/26/2011 12:39 AM, Steven D'Aprano wrote: Karim wrote: Hello Bob, I know this fact for function but in this case this is not a function but a constructor method of a class. Methods *are* functions. (Technically, they are lightweight wra

Re: [Tutor] placing widgets

2011-01-25 Thread Karim
several Frames and place your widget in it if you want more specific placements. Regards Karim ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] The trap of the year

2011-01-25 Thread Karim
Yes you're right. But the class and instance thing made me believe the context would be different. Error of judgment. Regards Karim On 01/25/2011 10:57 PM, Corey Richardson wrote: On 01/25/2011 04:28 PM, Karim wrote: Hello Bob, I know this fact for function but in this case this is

Re: [Tutor] The trap of the year

2011-01-25 Thread Karim
On 01/25/2011 10:12 PM, Jerry Hill wrote: On Tue, Jan 25, 2011 at 3:41 PM, Karim <mailto:karim.liat...@free.fr>> wrote: I am not really understanding why my init in the class made it refers to the same list object. What is the difference with 2nd example directly at t

Re: [Tutor] The trap of the year

2011-01-25 Thread Karim
time a new argument init. Regards Karim On 01/25/2011 10:20 PM, bob gailer wrote: *values are evaluated when th* ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] The trap of the year

2011-01-25 Thread Karim
surprise! I never see warning about this fact in any books before. Regards Karim On 01/25/2011 10:08 PM, Izz ad-Din Ruhulessin wrote: Or the internal memory id or whatever it's called. 2011/1/25 Izz ad-Din Ruhulessin <mailto:izzaddin.ruhules...@gmail.com>> I think it has someth

[Tutor] The trap of the year

2011-01-25 Thread Karim
;> class Device(): ... def __init__(self,parameters=None): ... self.parameters = None ... self.parameters = [] ... def param(self): ... print(id(self.parameters)) ... >>> a=Device() >>> b=Device() >>> b.param() 140559202956496 >>>

Re: [Tutor] Help listing directory timestamps and deleting directories

2011-01-24 Thread Karim
Hello, Also working w/o external module just the standard one: *>>> import datetime >>> remove_after = datetime.datetime.now() - datetime.timedelta(days=31) >>> remove_after datetime.datetime(2010, 12, 24, 23, 21, 10, 11315) * Regards Karim On 01/24/2011 08:02 PM

Re: [Tutor] What is __weakref__ ?

2011-01-18 Thread Karim
Thanks for the links Steven! Regards Karim On 01/18/2011 10:49 PM, Steven D'Aprano wrote: Karim wrote: Same thing I don't know what to do with this object weakref :-[ as I don't know its meaning. That was my true question in fact; http://mindtrove.info/python-weak-r

Re: [Tutor] Why super does not work !

2011-01-18 Thread Karim
On 01/17/2011 11:36 PM, Dave Angel wrote: On 01/-10/-28163 02:59 PM, Karim wrote: Hello, I implemented Observer DP on a listbox (Tkinter) as follows and I don't understand why super() is not working and Observable.__init__(self) is working, cf below: class ListObservable(Listbox, Obser

Re: [Tutor] What is __weakref__ ?

2011-01-18 Thread Karim
On 01/18/2011 03:38 PM, bob gailer wrote: def __getattr__(self, name): return self.enums[name] Note this does not handle the upper/lower case issue. Thanks for the trick! works perfect! Regards Karim ___ Tutor maillist - Tutor

Re: [Tutor] What is __weakref__ ?

2011-01-18 Thread Karim
to handle invalid litteral. Thanks! Regards Karim On 01/18/2011 02:24 PM, bob gailer wrote: On 1/18/2011 8:08 AM, Karim wrote: I know this is ugly but until now it is the only way (with this side effect) I found to declare Enums class that I _understand_: *class CategoryType(object):

  1   2   >