Re: popen2

2005-10-28 Thread g.franzkowiak
David Wahler schrieb: > g.franzkowiak wrote: > >>I start a process in my application with popen2.popen3('MyOtherProcess'). >>That's ok, but what can I do if the other process is running ? >>Can I fetch some information and start with that ? >> >>gerd > > > It's not clear what you're asking for.

Re: Microsoft Hatred FAQ

2005-10-28 Thread Paul Rubin
"David Schwartz" <[EMAIL PROTECTED]> writes: > Is it your position that Micorosoft's monopoly was illegal when they > first acquired it? It's utterly irrelevant whether it was illegal when they acquired it. The law is against acquiring OR MAINTAINING a monopoly by anticompetitive means. Tha

Re: How do I sort these?

2005-10-28 Thread KraftDiner
yes... Thats the idea... -- http://mail.python.org/mailman/listinfo/python-list

Re: OpenSSL in Python

2005-10-28 Thread Sybren Stuvel
dcrespo enlightened us with: > I've been looking for OpenSSL for python. I found pyOpenSSL, but it > requires the OpenSSL library, which I only found on > http://www.openssl.org/, but don't know how to install. Ehm... wouldn't your question then not be more appropriate on the OpenSSL newsgroup/mai

Re: XML Tree Discovery (script, tool, __?)

2005-10-28 Thread uche . ogbuji
""" I was looking for something similar (XML to DTD inference) but I didn't find anything related in python. Trang (http://www.thaiopensource.com/relaxng/trang-manual.html#introduction), on the other hand seems impressive after a few non-trivial tests. It would be neat to have it ported in python,

Re: How do I sort these?

2005-10-28 Thread KraftDiner
In C++ you can specify a comparision method, how can I do this with python... Say for instance the first list was a dictionary and I wanted to sort on one of the keys in the dictionary? -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I sort these?

2005-10-28 Thread KraftDiner
unzip doesn't seem to work for me... -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter Frame Size

2005-10-28 Thread James Stroud
On Friday 28 October 2005 11:00, Tuvas wrote: > Okay. I have alot of items that are put on the basic frame already, > using a grid method. Will this change anything? It shouldn't. For example from Tkinter import * app = Tk() app.geometry("%dx%d%+d%+d" % (600, 400, 0, 0)) f = Frame(app) f.pack() L

Re: How do I sort these?

2005-10-28 Thread Paul Rubin
"KraftDiner" <[EMAIL PROTECTED]> writes: > In C++ you can specify a comparision method, how can I do this with > python... Yes, see the docs. Just pass a comparison func to the sort method. -- http://mail.python.org/mailman/listinfo/python-list

Re: Microsoft Hatred FAQ

2005-10-28 Thread Mike Meyer
"David Schwartz" <[EMAIL PROTECTED]> writes: > "Mike Meyer" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> The quote about the mafia doesn't compare MS's actions to "actual use >> of force". > I'm sorry, that's just absurd. I won't speculate on what motivates you > to engage

Re: How do I sort these?

2005-10-28 Thread Sam Pointon
> unzip doesn't seem to work for me... It's not a part of the standard Python distribution, but this is a naive implementation (it doesn't react well to the list's contents having different lengths). def unzip(seq): result = [[] for i in range(len(seq[0]))] for item in seq: for in

Re: ? Pythoncard

2005-10-28 Thread LenS
Never mind I figured out my on stupid mistake Thanks -- http://mail.python.org/mailman/listinfo/python-list

newstyle classes and __getattribute__

2005-10-28 Thread Stefan Sonnenberg-Carstens
Hi there, I'm facing some strange things - but maybe only me is strange - anyway... i wrote the following code: +++ class T(object): def __init__(self,name='',port=80): self.name=name self.port=port +++ looks fine - to me. Now I can do: >>> t = T(name

Re: tkinter blues (greens, reds, ...)

2005-10-28 Thread Sean McIlroy
i'm using the canned colors ("pink", "orange", etc). should i try changing to explicit color specifications to see if that makes a difference? i'm not sure what the other guy meant by a "soft toy", but i take it the idea is to try and construct a correctness proof for the script, and see what keeps

Re: newstyle classes and __getattribute__

2005-10-28 Thread Stefan Sonnenberg-Carstens
Stefan Sonnenberg-Carstens schrieb: > Hi there, > I'm facing some strange things - but maybe only me is strange - anyway... > > i wrote the following code: > > > +++ > class T(object): > def __init__(self,name='',port=80): > self.name=name > self.port=port > +++ > > looks fi

Re: newstyle classes and __getattribute__

2005-10-28 Thread James Stroud
On Friday 28 October 2005 14:26, Stefan Sonnenberg-Carstens wrote: > Hi there, [..clip..] > Now, I do this: > > class T(object): > def __init__(self,name='',port=80): > self.name=name > self.port=port > def __getattribute__(self,key): > if key==

Re: newstyle classes and __getattribute__

2005-10-28 Thread Stefan Sonnenberg-Carstens
James Stroud schrieb: > On Friday 28 October 2005 14:26, Stefan Sonnenberg-Carstens wrote: > >>Hi there, > > [..clip..] > >>Now, I do this: >> >>class T(object): >> def __init__(self,name='',port=80): >> self.name=name >> self.port=port >> def __getattribute__

Re: How do I sort these?

2005-10-28 Thread Amaury
Sam Pointon a écrit : >>unzip doesn't seem to work for me... > > > It's not a part of the standard Python distribution, but this is a > naive implementation (it doesn't react well to the list's contents > having different lengths). > > def unzip(seq): > result = [[] for i in range(len(seq[0]

Re: newstyle classes and __getattribute__

2005-10-28 Thread Stefan Sonnenberg-Carstens
Stefan Sonnenberg-Carstens schrieb: > James Stroud schrieb: > >> On Friday 28 October 2005 14:26, Stefan Sonnenberg-Carstens wrote: >> >>> Hi there, >> >> >> [..clip..] >> >>> Now, I do this: >>> >>> class T(object): >>> def __init__(self,name='',port=80): >>> self.name=name >>>

Automatic binding of **kwargs to variables

2005-10-28 Thread [EMAIL PROTECTED]
Hi all, I have a very long list of parameters coming from a web form to my method foo(self, **kwargs) I would like to avoid manually binding the variables to the values coming through the **kwargs dictionary, just to keep the code cleaner, I'd like to bind them automatically I was adviced agains

Re: Scanning a file

2005-10-28 Thread Paul Watson
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I want to scan a file byte for byte for occurences of the the four byte > pattern 0x0100. I've tried with this: > > # start > import sys > > numChars = 0 > startCode = 0 > count = 0 > > inputFile = sys.stdin > > while True: >ch =

Re: How to replace all None values with the string "Null" in a dictionary

2005-10-28 Thread Steven D'Aprano
On Fri, 28 Oct 2005 05:23:00 -0700, dcrespo wrote: >> I think it would be time for you to read the Fine Manual... > > hi, thanks for your answer... I really did it the same way you > suggested, but I forgot to tell you that I wanted to get a better way > for doing it. What was wrong with the way

Re: Scanning a file

2005-10-28 Thread Steven D'Aprano
On Fri, 28 Oct 2005 15:29:46 +0200, Björn Lindström wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > >> f = open("filename", "rb") >> s = f.read() >> sub = "\x00\x00\x01\x00" >> count = s.count(sub) >> print count > > That's a lot of lines. This is a bit off topic, but I just can't sta

Re: Scanning a file

2005-10-28 Thread Steven D'Aprano
On Fri, 28 Oct 2005 06:22:11 -0700, [EMAIL PROTECTED] wrote: > Which is quite fast. The only problems is that the file might be huge. What *you* call huge and what *Python* calls huge may be very different indeed. What are you calling huge? > I really have no need for reading the entire file int

Re: Newbie question: string replace

2005-10-28 Thread Steven D'Aprano
On Fri, 28 Oct 2005 12:27:36 -0700, [EMAIL PROTECTED] wrote: > hm...Is there a way to get rid of the newline in "print"? Yes, by using another language *wink* Or, instead of using print, use sys.stdout.write(). -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I sort these?

2005-10-28 Thread Steven D'Aprano
On Fri, 28 Oct 2005 13:42:49 -0700, KraftDiner wrote: > unzip doesn't seem to work for me... Nor for me: >>> unzip Traceback (most recent call last): File "", line 1, in ? NameError: name 'unzip' is not defined I don't think it exists. But it is easy enough to create: def unzip(L): """

Re: Automatic binding of **kwargs to variables

2005-10-28 Thread Mike Meyer
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > I have a very long list of parameters coming from a web form to my > method foo(self, **kwargs) > > I would like to avoid manually binding the variables to the values > coming through the **kwargs dictionary, just to keep the code cleaner, > I'd lik

Re: ? Pythoncard

2005-10-28 Thread Lee Harr
On 2005-10-28, LenS <[EMAIL PROTECTED]> wrote: > Never mind I figured out my on stupid mistake > How about posting a very simple explanation of what you did wrong and how you fixed it, instead of leaving the next person who has this problem with a dead end? Thanks. -- http://mail.python.org/ma

Expanding Python as a macro language

2005-10-28 Thread qwweeeit
Hi all, when I moved from Windows to Linux I choosed Python as my language of reference and as GUI, Qt (not much investigated up to now). Till now I didn't regret but one thing: Python can't act as a macro language and so you are obliged to revert to Windows to use programs like AutoIt, Macro

Oh what a twisted thread we weave....

2005-10-28 Thread GregM
Hi First off I'm not using anything from Twisted. I just liked the subject line :) The folks of this list have been most helpful before and I'm hoping that you'll take pity on a the dazed and confused. I've read stuff on this group and various website and book until my head is spinning... Here i

Re: Microsoft Hatred FAQ

2005-10-28 Thread David Schwartz
"Mike Meyer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "David Schwartz" <[EMAIL PROTECTED]> writes: >> "Mike Meyer" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >>> The quote about the mafia doesn't compare MS's actions to "actual use >>> of force". >>

Automatically creating a HOME environ variable on Windows?

2005-10-28 Thread jim . eggleston
Windows doesn't have a HOME environment variable, but it does have HOMEDRIVE and HOMEPATH. Could Windows versions of Python automatically populate os.environ with HOME, where HOME = os.path.join(os.environ['HOMEDRIVE'], os.environ['HOMEPATH'])? If this was done, then modules such as pdb, which loa

Re: tkinter blues (greens, reds, ...)

2005-10-28 Thread Ron Adam
Sean McIlroy wrote: > i'm using the canned colors ("pink", "orange", etc). should i try > changing to explicit color specifications to see if that makes a > difference? i'm not sure what the other guy meant by a "soft toy", but > i take it the idea is to try and construct a correctness proof for

Re: Expanding Python as a macro language

2005-10-28 Thread SPE - Stani's Python Editor
Well on Windows I used some time ago for similar tasks the wmi module. It is able to analyse running programs, press buttons and activate menu items. As you didn't mention it, you might have a look at it. It works pretty well. http://tgolden.sc.sabren.com/python/wmi.html For linux I don't know.

Re: Print to printer

2005-10-28 Thread SPE - Stani's Python Editor
You should be more specific. What do you want to print? Text, images, ... If you want a cross platform solution you could use wxPython: http://wiki.wxwidgets.org/docbrowse.cgi/wxwin_printingoverview.html#printingoverview For text you could use wxHtmlEasyPrinting: http://wiki.wxpython.org/index.cgi

Re: Python-list Digest, Vol 25, Issue 522

2005-10-28 Thread Jay Parlar
On Oct 28, 2005, at 9:20 AM, pywrote: From what I have seen Python does not come with an snmp module built in, can anyone suggest some other SNMP module (preferably one you have used/experienced)..I have googled and seen yapsnmp and pysnmp (which seem to be the two most active SNMP modules). W

Generic utility class for passing data

2005-10-28 Thread Gordon Airporte
I'm wondering if this is might be bad practice. Sometimes when I need to pass around several pieces of datum I will put them in a tuple, then when I need to use them in a receiving function I get them out with subscripts. The problem is that the subscript number is completely meaningless and I

Re: Generic utility class for passing data

2005-10-28 Thread Alex Martelli
Gordon Airporte <[EMAIL PROTECTED]> wrote: > I'm wondering if this is might be bad practice. Sometimes when I need to I hope not, 'cuz I suggested that years ago on the Cookbook (under the name of Bunch) with several successive refinements. > class Dummy: > pass > > Then when I need to pa

Re: How do I sort these?

2005-10-28 Thread Alex Martelli
Paul Rubin wrote: > "KraftDiner" <[EMAIL PROTECTED]> writes: > > In C++ you can specify a comparision method, how can I do this with > > python... > > Yes, see the docs. Just pass a comparison func to the sort method. Or, better, pass a key-extraction function, that's

Re: Newbie question: string replace

2005-10-28 Thread Alex Martelli
Mike Meyer <[EMAIL PROTECTED]> wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > > So how to overwrite the config file directly in script.py instead of > > running script.py with two params? > > Don't overwrite the file directly. Save a copy, then rename it. That See module fileinput

Re: Newbie question: string replace

2005-10-28 Thread Alex Martelli
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Fri, 28 Oct 2005 12:27:36 -0700, [EMAIL PROTECTED] wrote: > > > hm...Is there a way to get rid of the newline in "print"? > > Yes, by using another language *wink* Ending the print statement with a comma also works;-) > Or, instead of using pri

pickling classes with __slots__

2005-10-28 Thread Alex Neyfakh
I would greatly appreciate an advice on the following matter that was very much discussed circa 2002 but in all this discussion I could not find the final answer with a code example. I have a series of new classes with child-parent relationship and each has unique __slots__. They don't have __d

Re: Scanning a file

2005-10-28 Thread Alex Martelli
Mike Meyer <[EMAIL PROTECTED]> wrote: ... > Except if you can't read the file into memory because it's to large, > there's a pretty good chance you won't be able to mmap it either. To > deal with huge files, the only option is to read the file in in > chunks, count the occurences in each chunk,

Re: Opaque documentation

2005-10-28 Thread Alex Martelli
Mike Meyer <[EMAIL PROTECTED]> wrote: > "Ben Sizer" <[EMAIL PROTECTED]> writes: > > Documentation is often a problem with Python and its libraries, sadly. > > The same almost certainly goes for most open source projects. > > You over-specified the last clause. It should say "most software > proj

Re: Why doesn't this work? :)

2005-10-28 Thread Alex Martelli
Jeremy Moles <[EMAIL PROTECTED]> wrote: > Am I misunderstanding something fundamental about the builtin __* > functions? Can they not be "static?" They can and must be static when their specification say they are (e.g., __new__) and they cannot and must not be static when their specification says

Re: Scanning a file

2005-10-28 Thread Paul Watson
"Paul Watson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >>I want to scan a file byte for byte for occurences of the the four byte >> pattern 0x0100. I've tried with this: >> >> # start >> import sys >> >> numCha

Re: suggestions between these two books

2005-10-28 Thread Alex Martelli
Micah Elliott <[EMAIL PROTECTED]> wrote: > On Oct 26, John Salerno wrote: > > Hi all. I'm fairly new to programming and I thought I'd like to try > > Python. I'm trying to decide between these two books: > > > > Learning Python (O'Reilly) > > Beginning Python: From Novice to Professional (APress)

pickling class instances with __slots__

2005-10-28 Thread Alex
I would greatly appreciate an advice on the following matter that was very much discussed circa 2002 but in all this discussion I could not find the final answer with a code example. Neither I can find it in Python documentation. I have a series of new classes with child-parent relationship and e

Re: tkinter blues (greens, reds, ...)

2005-10-28 Thread Sean McIlroy
hi ron changing from english words to hexadecimal numerals did the trick for me, so everything's cool now. thanks for looking at it. peace -- http://mail.python.org/mailman/listinfo/python-list

Re: pickling class instances with __slots__

2005-10-28 Thread Alex Martelli
Alex <[EMAIL PROTECTED]> wrote: ... > I have a series of new classes with child-parent relationship and each > has unique __slots__. They don't have __dict__ . I need to be able to > pickle and unpickle them. As far as I could understand, I need to > provide __getstate__ and __setstate__ metho

Re: Generic utility class for passing data

2005-10-28 Thread [EMAIL PROTECTED]
just curious, since python don't care what object is being passing around and the receiving function has to 'decode' it(be it tuple or dict or whatever). What is the advantage of dummy class ? Alex Martelli wrote: > Gordon Airporte <[EMAIL PROTECTED]> wrote: > > > I'm wondering if this is might be

Re: Generic utility class for passing data

2005-10-28 Thread Robert Kern
[EMAIL PROTECTED] wrote: > just curious, since python don't care what object is being passing > around and the receiving function has to 'decode' it(be it tuple or > dict or whatever). What is the advantage of dummy class ? The convenience of the attribute notation. For the record, my favorite va

Re: Generic utility class for passing data

2005-10-28 Thread [EMAIL PROTECTED]
ok, so that is simply a wrapper of a dict and has nothing to do with parameter passing and it can be used anyway within the receiving function(or basically anyway I want to say x.key rather than x[key]). def f(**kwargs): x = Bunch(kwargs) x.some_key_as_attribute = something Robert Kern wro

Re: Microsoft Hatred FAQ

2005-10-28 Thread Mike Meyer
"David Schwartz" <[EMAIL PROTECTED]> writes: > "Mike Meyer" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> "David Schwartz" <[EMAIL PROTECTED]> writes: >>> "Mike Meyer" <[EMAIL PROTECTED]> wrote in message >>> news:[EMAIL PROTECTED] >> Maybe true, maybe not - but it doesn't matte

Re: Scanning a file

2005-10-28 Thread Mike Meyer
"Paul Watson" <[EMAIL PROTECTED]> writes: > Here is a better one that counts, and not just detects, the substring. This > is -much- faster than using mmap; especially for a large file that may cause > paging to start. Using mmap can be -very- slow. > > #!/usr/bin/env python > import sys > > fn

Debugging with SciTE

2005-10-28 Thread jim . eggleston
I just figured out a reasonably decent way to use pdb in SciTE for debugging Python scripts. Debugging takes place in the SciTE output window. I have only tested this with SciTE on Windows. Here are the pieces you need: 1. Create a debug.py script file (I save this in c:\usr\python\scripts): impo

Understanding the arguments for SubElement factory in ElementTree

2005-10-28 Thread mirandacascade
Can the **extra argument in the SubElement() factory in ElementTree be used to set the text property? Example: Want the text associated with the tag to be xyz. xyz rather than: root = Element('root') subroot = SubElement(root, 'subroot') subroot.text = 'xyz' Was wondering whether this code

Re: Scanning a file

2005-10-28 Thread Fredrik Lundh
Mike Meyer wrote: > Did you do timings on it vs. mmap? Having to copy the data multiple > times to deal with the overlap - thanks to strings being immutable - > would seem to be a lose, and makes me wonder how it could be faster > than mmap in general. if you use "mmap" to read large files sequen

<    1   2