Re: List comprehension for testing **params

2012-11-12 Thread Cantabile
Wow, lots of things I had never heard of in your posts. I guess I need to do some homework... Cantabile -- http://mail.python.org/mailman/listinfo/python-list

List comprehension for testing **params

2012-11-11 Thread Cantabile
in params.keys. Could you explain why it doesn't work and do you have any idea of how it could work ? Thanks in advance :) Cheers, Cantabile -- http://mail.python.org/mailman/listinfo/python-list

Re: List comprehension for testing **params

2012-11-11 Thread Cantabile
Thanks everyone for your answers. That's much clearer now. I see that I was somehow fighting python instead of using it. Lesson learned (for the time being at least) :) I'll probably get back with more questions... Cheers, Cantabile -- http://mail.python.org/mailman/listinfo/python-list

Re: replace string in a file

2008-03-17 Thread cantabile
Le Mon, 17 Mar 2008 09:03:07 -0700, joep a écrit : An example: looks for all 'junk*.txt' files in current directory and replaces in each line the string 'old' by the string 'new' Josef Works like a charm. Many thanks for the example Josef :-) --

Re: Managing events

2005-09-04 Thread cantabile
Thanks to you all for these answers. I'll try these ideas and post back comments and results. -- http://mail.python.org/mailman/listinfo/python-list

Managing events

2005-09-03 Thread cantabile
Hi, I have a class (a gui) with buttons and other controls. A button, for example, has a callback method, so that writing b = Button(label, OnClick) will call the global OnClick method. Now, if I want the OnClick method to call some of my main class methods, I need to write: UI =

Re: gettext again

2005-08-10 Thread cantabile
stasz a écrit : On Tue, 09 Aug 2005 23:59:26 +0200, cantabile wrote: stas a écrit : As a reminder, make sure that you install gettext in the namespace of your toplevel module. [] Noticed something : I must import test2.py AFTER gettext.install('test1') and even then, if test3.py

Re: gettext again

2005-08-08 Thread cantabile
stasz a écrit : Your steps seems alright. Just a thought; you do start test1.py from a [EMAIL PROTECTED] environment do you? I mean in a xterm do: export [EMAIL PROTECTED] And then start test1.py from there. Stas Wht ! Working at last, after three days... It wasn't the LANG param

Re: gettext again

2005-08-08 Thread cantabile
BTW stasz, Maybe you'll have still some time for the following question. Trying my luck :)) Suppose I have several units (.py files), say test.py test1.py tets2.py , test.py being my main file. I've read I can import gettext and install in the main unit. Then, must I create .po files for each

gettext again

2005-08-07 Thread cantabile
Hi, I'm failing to make it work but can't find out what's wrong. Here's what I do : test.py import gettext gettext.install('') msg = _(Message without accented characters) print msg Then I do : xgettext test.py mv message.po message pot msginit -- output

Re: gettext again

2005-08-07 Thread cantabile
stasz a écrit : On Sun, 07 Aug 2005 11:09:14 +0200, cantabile wrote: Hi, I'm failing to make it work but can't find out what's wrong. Here's what I do : [] How come ? What's wrong with what I am doing ? Start with this little howto about gettext. http

Re: gettext again

2005-08-07 Thread cantabile
stasz a écrit : On Sun, 07 Aug 2005 21:33:21 +0200, cantabile wrote: stasz a écrit : On Sun, 07 Aug 2005 11:09:14 +0200, cantabile wrote: Hi, I'm failing to make it work but can't find out what's wrong. Here's what I do : [] How come ? What's wrong with what I am doing ? Start

about coding

2005-08-06 Thread cantabile
Hi, being a newbie in Python, I'm a bit lost with the '-*- coding : -*-' directive. I'm using an accented characters language. Some of them are correctly displayed while one doesn't. I've written : -*- coding: utf-8 -*- Is this wrong ? Where can I find a pratical explanation about these

Re: about coding

2005-08-06 Thread cantabile
Robert Kern a écrit : It depends. Are those characters encoded as UTF-8? Or, more likely, are they encoded as ISO-8859-1? Where can I find a pratical explanation about these encodings ? http://www.amk.ca/python/howto/unicode http://en.wikipedia.org/wiki/Character_encoding

Re: pygettext ?

2005-08-03 Thread cantabile
Reinout van Schouwen a écrit : Hi, On Wed, 3 Aug 2005, cantabile wrote: Hi, I'm trying to write an internationalized app. I'm learning python and read that pygettext would help me, but I found elsewhere it was obsolete (??) So, what's the correct and up to date tool to i18n python

Re: pygettext ?

2005-08-03 Thread cantabile
Jon Hewer a écrit : Hi I'm pretty new to Python, and recently been working my way through Dive Into Python, and I'm currently writing a really simple rss reader purely to get familiarised with the language. I want to move onto something a little more challenging, but I'm stuck for ideas on

pygettext ?

2005-08-02 Thread cantabile
Hi, I'm trying to write an internationalized app. I'm learning python and read that pygettext would help me, but I found elsewhere it was obsolete (??) So, what's the correct and up to date tool to i18n python ? Is there a tutorial somewhere (python docs has nothing really usable : I'd like at

ConfigParser : overwrite ?

2005-07-17 Thread cantabile
Hi, I'm trying and updating an .ini file with ConfigParser but each time I call 'write', it appends the whole options another time to the file. For example : Here's the inital ini file [section1] foodir: %(dir)s/whatever dir: foo Here's my code : filename = ... config =

Re: ConfigParser : overwrite ?

2005-07-17 Thread cantabile
Robert Kern a écrit : cantabile wrote: Hi, I'm trying and updating an .ini file with ConfigParser but each time I call 'write', it appends the whole options another time to the file. For example : Here's the inital ini file [section1] foodir: %(dir)s/whatever dir: foo Here's my code

Re: Pattern question

2005-07-09 Thread cantabile
Scott David Daniels a écrit : cantabile wrote: bruno modulix a écrit : You may want to have a look at the Factory pattern... ... demo of class Factory ... Taking advantage of Python's dynamic nature, you could simply: # similarly outrageously oversimplified dummy example

Re: Pattern question

2005-07-08 Thread cantabile
bruno modulix a écrit : You may want to have a look at the Factory pattern... # outrageously oversimplified dummy exemple class Gui(object): def __init__(self, installer): self.installer = installer class PosixGui(Gui): pass class Win32Gui(Gui): pass class

Pattern question

2005-07-07 Thread cantabile
Hi, I'm trying to write a small installer for a server. But this program should be able to run in the future under heterogenous environments and os (at least linux/windows). I mean, the install will be done either in text mode or curses or gtk or tk, either in debian or windows 2000 and so on...

Re: Get drives and partitions list (Linux)

2005-06-14 Thread cantabile
Thanks for the answer and help. Cheers :) Peter Hansen wrote: cantabile wrote: Hi, Peter Thanks for the reply. I'll check popen(). But you said I should not rely on fdisk... Why ? And should I prefer sfdisk ? Why ? I was under the impression that fdisk was older and more primitive

Re: Get drives and partitions list (Linux)

2005-06-13 Thread cantabile
Hi, Jeff Great help : this works like a charm. I think I can customize it to read from sfdisk. Do you agree with Peter Hansen (post below) about fdisk ? Jeff Epler wrote: Using /proc/partitions is probably preferable because any user can read it, not just people who can be trusted with read

Re: Get drives and partitions list (Linux)

2005-06-13 Thread cantabile
Hi, Peter Thanks for the reply. I'll check popen(). But you said I should not rely on fdisk... Why ? And should I prefer sfdisk ? Why ? Peter Hansen wrote: cantabile wrote: Hi, I'd like to get drives and partitions (and their size too) with python under Linux. So far, I thought of reading

Get drives and partitions list (Linux)

2005-06-12 Thread cantabile
Hi, I'd like to get drives and partitions (and their size too) with python under Linux. So far, I thought of reading /proc/partitions but maybe i could use fdsik also ? How would I do that in python ? Thanks for your help (newbie here :) ) -- http://mail.python.org/mailman/listinfo/python-list