Re: Search and replace text in XML file?

2012-07-27 Thread Jason Friedman
> I'm looking to search an entire XML file for specific text and replace that > text, while maintaining the structure of the XML file. The text occurs within > multiple nodes throughout the file. > I basically need to replace every occurrence C:\Program Files with C:\Program > Files (x86), regar

Search and replace text in XML file?

2012-07-27 Thread todd . tabern
I'm looking to search an entire XML file for specific text and replace that text, while maintaining the structure of the XML file. The text occurs within multiple nodes throughout the file. I basically need to replace every occurrence C:\Program Files with C:\Program Files (x86), regardless of l

Re: PyCon for students?

2012-07-27 Thread Michael Hrivnak
Having a conference during the summer is generally more expensive, because you have to compete with tourists for lodging and such. For this reason, summer-time conventions are often in places where nobody wants to be during the summer, like Phoenix. That said, Santa Clara probably isn't a cheap l

Re: argparse limitations

2012-07-27 Thread Benoist Laurent
Yes basically looks like you get it. I have to further test it but my first impression is that it's correct. So actually the point was to use nargs="?". Thank you very much. Ben Le Jul 27, 2012 à 5:44 PM, Peter Otten a écrit : > Benoist Laurent wrote: > >> I'm impletting a tool in Python.

Re: argparse limitations

2012-07-27 Thread Ian Kelly
On Fri, Jul 27, 2012 at 10:26 AM, Ian Kelly wrote: > It may be a bit awkward having to type "-i" once per file in the > command line, but it does clear up the ambiguity. Or you could bite the bullet and make the input files argument part of the subparser, which you may find ugly, but I believe it

Re: argparse limitations

2012-07-27 Thread Ian Kelly
On Fri, Jul 27, 2012 at 9:19 AM, Benoist Laurent wrote: > That's the solution I came to. > But I'm not very happy with this since I can definitively not make my > program act as a standard unix tool. > Any other solution? I don't understand; that's pretty much the same way that standard unix tool

Re: argparse limitations

2012-07-27 Thread Peter Otten
Benoist Laurent wrote: > I'm impletting a tool in Python. > I'd like this tool to behave like a standard unix tool, as grep for > exemple. I chose to use the argparse module to parse the command line and > I think I'm getting into several limitations of this module. > >> First Question. > How can

Re: argparse limitations

2012-07-27 Thread Benoist Laurent
Le Jul 27, 2012 à 4:43 PM, Oscar Benjamin a écrit : > > > On 27 July 2012 15:26, Benoist Laurent wrote: > Hi, > > I'm impletting a tool in Python. > I'd like this tool to behave like a standard unix tool, as grep for exemple. > I chose to use the argparse module to parse the command line and

Re: Initial nose experience

2012-07-27 Thread Roy Smith
In article , Roy Smith wrote: > Lastly, nose, by default, doesn't say much. When things go wrong and > you have no clue what's happening, --verbose and --debug are your > friends. I found another example of nose not saying much, and this one is kind of annoying. Unittest has much richer as

PyCon for students?

2012-07-27 Thread Devin Jeanpierre
Hey guys, I recently saw a post saying that PyCon for students' price was dropped to $100. If you are trying to attract students, why not move PyCon to take place during the summer? As far as I know, summer vs spring makes no difference to any members of the general working population (except for

Re: argparse limitations

2012-07-27 Thread Oscar Benjamin
On 27 July 2012 15:26, Benoist Laurent wrote: > Hi, > > I'm impletting a tool in Python. > I'd like this tool to behave like a standard unix tool, as grep for > exemple. > I chose to use the argparse module to parse the command line and I think > I'm getting into several limitations of this modul

argparse limitations

2012-07-27 Thread Benoist Laurent
Hi, I'm impletting a tool in Python. I'd like this tool to behave like a standard unix tool, as grep for exemple. I chose to use the argparse module to parse the command line and I think I'm getting into several limitations of this module. > First Question. How can I configure the the ArgumentPa

Re: dynamic setattr

2012-07-27 Thread Mariano Di Felice
Hi Steven, Sorry for inconvenients. I've posted "unsyntax" example just typing from here, just for exaplain my problem Finally, I don't understand why every set_ set value on wrong section/key. I think setattr syntax is correct, but it doesn't works! About java/python concept, yeah! You all ri

Re: dynamic setattr

2012-07-27 Thread Steven D'Aprano
On Fri, 27 Jul 2012 05:49:45 -0700, Mariano Di Felice wrote: > Hi, > I have a property file (.ini) that has multiple sections and relative > keys, as default structure. Have you looked at Python's standard INI file library? http://docs.python.org/library/configparser.html > Now, I would li

dynamic setattr

2012-07-27 Thread Mariano Di Felice
Hi, I have a property file (.ini) that has multiple sections and relative keys, as default structure. Now, I would like to export from my utility class methods getter and setter. I have started as is: class Utility: keys = {"STANDUP": ["st_key1", "st_key2", "st_key3", "st_key4"],

Re: ANN: dbf.py 0.94.003

2012-07-27 Thread Ethan Furman
Simon Cropper wrote: On 27/07/12 05:31, Ethan Furman wrote: A few more bug fixes, and I actually included the documentation this time. :) It can be found at http://python.org/pypi/dbf, and has been tested on CPythons 2.4 - 2.7, and PyPy 1.8. [snip] Ethan, That's great. Can you comment on

Re: reloading code and multiprocessing

2012-07-27 Thread andrea crotti
2012/7/25 andrea crotti : > > I would also like to avoid this in general, but we have many > subprocesses to launch and some of them might take weeks, so we need > to have a process which is always running, because there is never a > point in time where we can just say let's stop everything and sta

Re: regexps to objects

2012-07-27 Thread Peter Otten
andrea crotti wrote: > I have some complex input to parse (with regexps), and I would like to > create nice objects directy from them. > The re module doesn't of course try to conver to any type, so I was > playing around to see if it's worth do something as below, where I > assign a constructor t

Re: Generating valid identifiers

2012-07-27 Thread Laszlo Nagy
> With 16 ** 10 possible digests, the probability of collision hits 50% at 1234605 tables Actually, I'm using base64 encoding. So it is 64**10. I guess using 6 characters will enough. -- http://mail.python.org/mailman/listinfo/python-list

regexps to objects

2012-07-27 Thread andrea crotti
I have some complex input to parse (with regexps), and I would like to create nice objects directy from them. The re module doesn't of course try to conver to any type, so I was playing around to see if it's worth do something as below, where I assign a constructor to every regexp and build an obje

Re: Generating valid identifiers

2012-07-27 Thread Laszlo Nagy
Unless an attacker can select the field names, in which case they may be able to improve those odds significantly. In the case of MD5, they can possibly improve those odds to 1 in 1, since MD5 is vulnerable to collision attacks. Not so for some (all?) of the SHA hashes, at least not yet, but the

Re: Generating valid identifiers

2012-07-27 Thread Laszlo Nagy
As a side note, the odds of having at least one hash collision among multiple tables are known as the birthday problem. At 4 hex digits there are 65536 possible digests, and it turns out that at 302 tables there is a >50% chance that at least one pair of those names have the same 4-digit digest

Re: from future import pass_function

2012-07-27 Thread Ulrich Eckhardt
Am 26.07.2012 09:50, schrieb Mark Lawrence: And if we could persuade the BDFL to introduce braces, we could have {() and }() What do you mean "persuade"? Braces work perfectly: def foo(): {} Uli -- http://mail.python.org/mailman/listinfo/python-list

Re: codecs.register_error for "strict", unicode.encode() and str.decode()

2012-07-27 Thread Peter Otten
Alan Franzoni wrote: > Hello, > I think I'm missing some piece here. > > I'm trying to register a default error handler for handling exceptions > for preventing encoding/decoding errors (I know how this works and that > making this global is probably not a good practice, but I found this > strang