Re: [Tutor] Extracting xml text

2010-06-20 Thread Karim
= ParserCreate() # création du parser parser.StartElementHandler = start_element # initialization parser.ParseFile(file(sys.argv[1])) # get the input file print '%d opening tags' % n Regards Karim France On 06/20/2010 08:03 AM, T.R. D. wrote: xml strings and so far it look

Re: [Tutor] Extracting xml text

2010-06-20 Thread Karim
In fact you must initialize the handler before parsing the xml doc and it should work. Regards Karim France On 06/20/2010 10:12 AM, Karim wrote: Hello, The following is an example which works for me to count opening tags in a xml doc, if it can help: # -*- coding: iso-8859-1 -*- import

Re: [Tutor] Extracting xml text

2010-06-20 Thread Karim
Hello Stefan, I know you are promoting Etree and I am very interesting in it. Is there any chance to have it integrated in future standard Python version? Regards Karim On 06/20/2010 10:14 AM, Stefan Behnel wrote: T.R. D., 20.06.2010 08:03: I'm trying to parse a list of xml strings a

Re: [Tutor] elif statement

2010-08-11 Thread Karim
tring '-- Line 6' in you example given that has nothing to do with the rest of the code. Regards Karim On 08/11/2010 03:34 AM, Sudarshana Banerjee wrote: print "x is a even number" ___ Tutor maillist - Tutor@python.org T

[Tutor] Executing Python from TCL

2010-08-11 Thread Karim
don't have any idea how to do it :o) ) In fact, I develop parser for xml using xml.etree.ElementTree and another team which develop in TCL need to access it via an API I should do. Great Challenge. Regards Karim ___ Tutor maillist - Tutor@python.o

Re: [Tutor] Executing Python from TCL

2010-08-11 Thread Karim
This is the open source Elmer distribution. Thanks Karim On 08/12/2010 02:13 AM, Alan Gauld wrote: "Karim" wrote I want to know if there are modules or whatever to execute python functions inside TCL. Not that I know of, unless Google tells you something different. You can of cou

Re: [Tutor] Executing Python from TCL

2010-08-12 Thread Karim
Thanks Alan, For clarify that. The speed is not an issue people just need config files generated from xml to feed EDA simulations and validations tools. Karim On 08/12/2010 09:39 AM, Alan Gauld wrote: "Karim" wrote Anyway, you're right I found what I needed at: http://

Re: [Tutor] Elementtree and pretty printing in Python 2.7

2010-08-22 Thread Karim
Sorry wrong import! from xml.minidom import parseString from xml.etree import ElementTree Karim On 08/22/2010 05:24 PM, Karim wrote: Hello Jerry, Tricky solution using minidom (standard) Not tested: import ElementTree import minidom def prettyPrint(element): txt = ElementTree.tostring

Re: [Tutor] Elementtree and pretty printing in Python 2.7

2010-08-23 Thread Karim
Hello Jerry, Tricky solution using minidom (standard) Not tested: import ElementTree import minidom def prettyPrint(element): txt = ElementTree.tostring(element) print minidom.parseString(txt).toprettyxml() Regards Karim On 08/22/2010 04:51 PM, Jerry Hill wrote: On Fri, Aug 20, 2010

[Tutor] Retriving previous user inputs in a gui

2010-08-24 Thread Karim
format or whatever? pyGTK solution is welcome too! Even if I prefered to use the standard package. Regards Karim ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Retriving previous user inputs in a gui

2010-08-24 Thread Karim
eally load it as python setting file inside python program. PS: ConfigParser, hum very good , this could be of use for other part... Karim On 08/24/2010 08:03 PM, Alan Gauld wrote: "Karim" wrote I am figuring this out. I want a sort of file who store values entered previously in

Re: [Tutor] Retriving previous user inputs in a gui

2010-08-24 Thread Karim
Gui as follow: def sourceConfigGui(mySourceFile,path_to_mysourcefile): import mySourceFile import sys sys.path.append(path_to_mysourcefile) If you have any other solution to source a external py file let me know. Regards On 08/24/2010 08:21 PM, Karim wrote: Thank you Alan for your answer. In fac

Re: [Tutor] Retriving previous user inputs in a gui

2010-08-24 Thread Karim
Correction indents disappear (sic !) and lines are inverted (my mistake too) :o): def sourceConfigGui(mySourceFile,path_to_mysourcefile): import sys sys.path.append(path_to_mysourcefile) import mySourceFile Karim On 08/24/2010 09:28 PM, Karim wrote: Ok I find a

Re: [Tutor] Retriving previous user inputs in a gui

2010-08-24 Thread Karim
with .py then import it and at last delete the symbolic link). I should do a small class for that to reuse it. At first I tried to access it as variables instead of using .variable. I learnt something here! Regards Karim On 08/24/2010 09:38 PM, Karim wrote: Correction indents disappear

Re: [Tutor] Retriving previous user inputs in a gui

2010-08-24 Thread Karim
config or format file? Regards Karim On 08/25/2010 01:57 AM, Alan Gauld wrote: "Karim" wrote >>> import params >>> dir(params) ['EntryTextMail', 'EntryTextName', '__builtins__', '__doc__', But the file to import should

Re: [Tutor] python: can't open file 'ex1.py' : [Errno 2] No such file or directory

2010-08-24 Thread Karim
If it is in the sys.path you should import it: *import ex1*. Then execute something like *ex1.main()* if you did a main(). Other python */ex.py* should world. Regards Karim On 08/25/2010 05:22 AM, Carter Danforth wrote: Hi everyone, This is my first email to group - I'm just starting to

[Tutor] What Design Pattern for Document class (NOT URGENT)

2010-08-25 Thread Karim
, for if anybody has this kind of experience or any design pattern idea, I will be enchanté. Regards Karim ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] pythonpath

2010-11-01 Thread Karim
subscription options: http://mail.python.org/mailman/listinfo/tutor Hello, PYTHONPATH environment variable set to /path/to/you/libs. Regards Karim ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org

Re: [Tutor] Too different 2.6 vs 2.7?

2010-11-08 Thread Karim
Hello Jorge, I have Ubuntu 10.04 LTS and get the same issue. I installed 2.7 version manually in another place using -prefix option. It works as long as you are pointing to the correct bin (python2.7) and the local lib/ installation (PYTHONPATH) from python 2.7. Regards Karim On 11/08/2010 09

Re: [Tutor] Python module structure & directories

2010-11-25 Thread Karim
executable do the following as Alan said: *if ! echo $PYTHON | grep "/lib" > /dev/null ; then export PYTHONPATH="/lib:${PYTHONPATH}" fi* The conditional statement is here just to not overload the environment variable. Best Regards Karim On 11/25/2010 02:23 AM, Alan Gauld wrot

Re: [Tutor] Python module structure & directories

2010-11-25 Thread Karim
Regards Karim On 11/25/2010 02:23 AM, Alan Gauld wrote: "Judy Chen" wrote I am very new to Python, I worked on C/C++ before. I would like to know is it a good practice to put Python development code under ../src/UI/foo.py ../src/businesslogic/bar.py, etc. Thats fine, especially if

[Tutor] Package loading

2010-11-29 Thread Karim
/lib/python2.6/dist-packages/pyparsing-1.5.5-py2.6.egg', '*/home/karim/build/UML2PDK/lib/python*', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/l

Re: [Tutor] Package loading

2010-11-29 Thread Karim
On 11/29/2010 09:15 PM, Karim wrote: Hello every one, I created a package with the following structure: * ops/ o __init__.py o tcl/ + __init__.py + pythontcl.py > *python -c "import sys; print sys.path; import ops.tcl.p

Re: [Tutor] Package loading

2010-11-30 Thread Karim
On 11/30/2010 12:58 AM, Karim wrote: On 11/29/2010 09:15 PM, Karim wrote: Hello every one, I created a package with the following structure: * ops/ o __init__.py o tcl/ + __init__.py + pythontcl.py > *python -c "import sy

[Tutor] The Template Pattern

2010-12-13 Thread Karim
Hello all, I am seeking for information about the template pattern applied to python. Could you explain some implementation or anything else? it would be helpful. Regards Thanks a lot Karim ___ Tutor maillist - Tutor@python.org To unsubscribe or

Re: [Tutor] The Template Pattern

2010-12-13 Thread Karim
On 12/13/2010 11:47 PM, Steven D'Aprano wrote: Karim wrote: Hello all, I am seeking for information about the template pattern applied to python. Could you explain some implementation or anything else? it would be helpful. Design patterns are means to an end, not an end in themselves

Re: [Tutor] The Template Pattern

2010-12-17 Thread Karim
Hello Steven, Could take some time when possible to answer to my follow-up question? Thank you! Cheers Karim On 12/14/2010 12:19 AM, Karim wrote: On 12/13/2010 11:47 PM, Steven D'Aprano wrote: Karim wrote: Hello all, I am seeking for information about the template pattern appli

Re: [Tutor] Writing to the terminal?

2010-12-17 Thread Karim
Hello Steven, I added the pipe char '|' to have a complete spinner! This would be set as a function for my wait routine installer. Thanks to share! Karim On 12/10/2010 09:51 PM, Steven D'Aprano wrote: Modulok wrote: List, Forgive me if I don't describe this well, I&

Re: [Tutor] Writing to the terminal?

2010-12-17 Thread Karim
('=') f.flush() # make the change visible immediately else: f.write('\n') progressBar( doSomeStuff ) Cheers Karim On 12/18/2010 08:05 AM, Karim wrote: Hello Steven, I added the pipe char '|' to have a complete spinner! This would be set as a function

Re: [Tutor] The Template Pattern

2010-12-19 Thread Karim
Thanks a lot to point this out! Karim On 12/19/2010 04:33 AM, Steven D'Aprano wrote: Karim wrote: class InputStrategy( object ): """This InputStrategy class is an abstract interface to various read strategy objects. """ def read(self, fileP

[Tutor] xml.etree.ElementTree.parse() against a XMLShema file

2010-12-22 Thread Karim
Hello all, Is somebody has an example of the way to parse an xml file against a "grammary" file.xsd. The default parser is checking closing tags and attributes but I would like to validate a XSD file. I use the module ElementTree. Reg

Re: [Tutor] xml.etree.ElementTree.parse() against a XMLShema file

2010-12-22 Thread Karim
On 12/22/2010 07:07 PM, Karim wrote: Is somebody has an example of the way to parse an xml file against a "grammary" file.xsd. I found this: http://www.velocityreviews.com/forums/t695106-re-xml-parsing-with-python.html Stefan is it still true the limitation of etree in py

Re: [Tutor] xml.etree.ElementTree.parse() against a XMLShema file

2010-12-22 Thread Karim
hings which works at best for python interest ? Regards Karim On 12/22/2010 09:56 PM, Stefan Behnel wrote: Karim, 22.12.2010 19:28: On 12/22/2010 07:07 PM, Karim wrote: Is somebody has an example of the way to parse an xml file against a "grammary" file.xsd. I fo

Re: [Tutor] xml.etree.ElementTree.parse() against a XMLShema file

2010-12-22 Thread Karim
On 12/22/2010 10:32 PM, Stefan Behnel wrote: Karim, 22.12.2010 22:09: Using lxml (except for the different import) will be fully compliant with the ET code. Do I have to adapt it? There are certain differences. http://codespeak.net/lxml/compatibility.html This page hasn't been change

Re: [Tutor] Dynamically generated classes

2010-12-23 Thread Karim
Hello Alan, You mentioned the facade pattern. Could you please provide a basic simple implementation of this pattern in python? Regards Karim On 12/23/2010 10:13 AM, Alan Gauld wrote: "Rasjid Wilcox" wrote I've been playing with dynamically generated classes. In par

Re: [Tutor] Dynamically generated classes

2010-12-23 Thread Karim
Thanks for the link. I use Adapter already for java to align to different interface. I was curious about the facade implementation. Regards Karim On 12/23/2010 01:25 PM, Alan Gauld wrote: "Karim" wrote You mentioned the facade pattern. Could you please provide a bas

Re: [Tutor] Dynamically generated classes

2010-12-23 Thread Karim
erivatives of Foo and Bar (as you use new databases for example) HTH, By the way Alan your solution is simple and beautiful! I like this kind of flexible design. Regards Karim ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscr

[Tutor] Try except really better than if?

2011-01-09 Thread Karim
: Is this true? And why using try-except is indeed encouraged to code as a pythonista? Regards Karim ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Try except really better than if?

2011-01-10 Thread Karim
e an alternative or my way is ok? I know there is no special case which is enough special to break the rule ;o) Regards Karim On 01/10/2011 03:10 AM, Alan Gauld wrote: ctions are slower than static functions, but that ___ Tutor maillist - Tut

Re: [Tutor] Try except really better than if?

2011-01-10 Thread Karim
Thanks Alan this reassures me! Regards Karim On 01/10/2011 10:39 AM, ALAN GAULD wrote: By the way I have this piece of code using elementTree standard module and according to Alan this is bad code I guess: Which just proves there are no absolute rules in programming

Re: [Tutor] Try except really better than if?

2011-01-10 Thread Karim
Steven many thanks for this useful hint! I will modify my code. Many thanks! Regards Karim On 01/10/2011 11:32 AM, Steven D'Aprano wrote: Karim wrote: Thank you Steven, Modulok and Alan for your precious and detailed explanations! I understood that I must not overuse try-except stat

[Tutor] Equality of numbers and Strings

2011-01-10 Thread Karim
dentical (numerically). I get the same object in py db. It could be evident but if I do the same (same elements) with a list it will not give the same result. Is-it because of immutable property of strings and numbers? Regards Karim ___ Tutor maillist

Re: [Tutor] Equality of numbers and Strings

2011-01-10 Thread Karim
Many thanks Emile, Bob, Stefan, Wesley! Now, I see now that the point is more related to implementation details and optimization instead of a true property. But it could mistaken people not aware. Regards Karim On 01/10/2011 06:56 PM, Stefan Behnel wrote: Karim, 10.01.2011 17:07: I am not

Re: [Tutor] How to insert a quit-Button in a Tkinter class?

2011-01-12 Thread Karim
text='Quit', command=self.quit ) self.quitButton.grid() app = App() app.master.title("Clock Time!") app.mainloop() Regards Karim On 01/12/2011 08:41 PM, Enih Gilead wrote: Hi, all ! I've being strugling a lot trying to insert (just as exemple) a quit-Button in

Re: [Tutor] How to insert a quit-Button in a Tkinter class?

2011-01-12 Thread Karim
text='Quit', command=self.quit ) self.quitButton.grid() app = App() app.master.title("Clock Time!") app.mainloop() Regards Karim On 01/12/2011 08:41 PM, Enih Gilead wrote: Hi, all ! I've being strugling a lot trying to insert (just as exemple) a quit-Button in

Re: [Tutor] How to insert a quit-Button in a Tkinter class?

2011-01-12 Thread Karim
/_Sorry my mistake in createLabel() method:_/ self.label = Label(text="") instead of : self.label = *Tkinter*.Label(text="") On 01/12/2011 09:23 PM, Karim wrote: Hello, Inherit from Frame see below: from Tkinter import * class App(Frame): def __init

Re: [Tutor] question

2011-01-12 Thread Karim
offvalue="no" ) If this checkbutton is on, self.spamVar.get() will return the string "yes"; if the checkbutton is off, that same call will return the string "no". Furthermore, your program can turn the checkbutton on by calling .set("yes")." Regards Kar

Re: [Tutor] module to parse XMLish text?

2011-01-14 Thread Karim
27;] lname.append(libName) * Regards Karim On 01/14/2011 03:55 AM, Terry Carroll wrote: Does anyone know of a module that can parse out text with XML-like tags as in the example below? I emphasize the "-like" in "XML-like". I don't think I can parse this

Re: [Tutor] end parameter in 2.7.1?

2011-01-15 Thread Karim
IN 3.1 for print(): >>> print('hello', end =' ') hello>>> It suppress the newline character. On 01/15/2011 07:05 PM, Emile van Sebille wrote: On 1/15/2011 9:35 AM Bill DeBroglie said... Twice in two days...! Using Mac OS X 10.5.8 and Python 2.7.1 but am following a book which is using Pyth

Re: [Tutor] module to parse XMLish text?

2011-01-15 Thread Karim
against DTD or XSD and many many other features (speed, etc...) Regards Karim On 01/15/2011 07:53 AM, Stefan Behnel wrote: Wayne Werner, 15.01.2011 03:25: On Fri, Jan 14, 2011 at 4:42 PM, Terry Carroll wrote: On Fri, 14 Jan 2011, Karim wrote: from xml.etree.ElementTree import ElementTree

[Tutor] What is __weakref__ ?

2011-01-17 Thread Karim
Hello, I am wondering what is this special class attribut. I know __dict__, slots. I use slots = [] when I want to use a read only class. But is anyone could explain with a little example the use of __weakref__? Regards karim ___ Tutor maillist

[Tutor] Why super does not work !

2011-01-17 Thread Karim
rAppliGraphique.py", line 37, in __init__ self.sujet.attach(self.nom) File "/home/karim/guiObserver/observable.py", line 11, in attach self._observers.append(observer) AttributeError: 'ListObservable' object has no attribute '_observers' And the Observa

Re: [Tutor] Why super does not work !

2011-01-17 Thread Karim
it's awful). The code is working but I am not totally happy because of many EntryObserver almost identical objects (except from update and grid() options) Is it possible to simplify this structure? Regards Karim The rest of the code is below: #!/usr/bin/env python2.7 """Mo

Re: [Tutor] Why super does not work !

2011-01-18 Thread Karim
sujet) self.text = StringVar() Entry.__init__(self, textvariable=self.text) self.grid(row=2, column=2) def update(self): a = self.sujet.getValue() self.text.set(data_base[a][0])* I still need a advice about the possible improvement specially for Entry observer object.

Re: [Tutor] What is __weakref__ ?

2011-01-18 Thread Karim
Hello Steven, (1) slots = [] doesn't do anything special. You have misspelled __slots__. Yes sorry my mistake :-[ (2) Classes don't become read only just because you add __slots__ to them. All you prevent is adding extra attributes, and why would you wish to do that? I know this is ugly

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):

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] 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
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] 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

[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] 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

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
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
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] 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
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] 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
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] 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] 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-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

[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] 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

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
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] 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] 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
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
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] 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

[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] 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

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] 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] 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] 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] 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

[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] 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

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
: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
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
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 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-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-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
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

[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] 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

  1   2   >