Python/wxPython Reducing memory usage.

2005-04-08 Thread lotmr
I have previously posted a simple app I am working on, and while I love python and wxWindows, after checking the memory usage on such a simple app (system try application launcher) I see that it climbs to over 17mb! I have reduced all my imports to the bare workable minimum and that just gets it un

Re: Thoughts on some stdlib modules

2005-04-08 Thread Steve Holden
Ron_Adam wrote: On Fri, 08 Apr 2005 05:15:23 -0400, vegetax <[EMAIL PROTECTED]> wrote: Are those issues being considered right now? i cant find any PEP addressing the issue especifically, at least cooking it for python 3000. specific topics could be: grouping related modules. removing useless lega

Re: Https Form Page

2005-04-08 Thread Hasan D
I cant figure out, always gives me the form page. Everything looks ok but ? On Apr 9, 2005 2:07 AM, Joshua Ginsberg <[EMAIL PROTECTED]> wrote: > If url is your formpage and your formdata is correct, it should work. > > Do you need to have a cookie set? Is it 304 redirecting you? > > -jag > >

shelve and concurrency

2005-04-08 Thread Michele Simionato
The standard library says: """ The shelve module does not support concurrent read/write access to shelved objects. (Multiple simultaneous read accesses are safe.) When a program has a shelf open for writing, no other program should have it open for reading or writing. """ But what about threads? I

Re: Thoughts on some stdlib modules

2005-04-08 Thread Ron_Adam
On Fri, 08 Apr 2005 05:15:23 -0400, vegetax <[EMAIL PROTECTED]> wrote: >Are those issues being considered right now? i cant find any PEP addressing >the issue especifically, at least cooking it for python 3000. > >specific topics could be: > >grouping related modules. >removing useless legacy modu

Re: Python Equivalent to Java Interfaces?

2005-04-08 Thread Michele Simionato
Google for "Hettinger interface checking": the first hit is the cookbook recipe you are looking for. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Equivalent to Java Interfaces?

2005-04-08 Thread gene . tani
There's 4 places to look: zope, twisted, PEAK and pyProtocols: this link describes pyprotocols pretty well http://peak.telecommunity.com/protocol_ref/module-protocols.html http://peak.telecommunity.com/PyProtocols.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Equivalent to Java Interfaces?

2005-04-08 Thread George Sakkis
"Brian Kazian" wrote: > I want to insure that all subclasses implement a certain method, but could > not find anything that would do this for me. Is there anyway in Python to > implement this check? Thanks! Check out PyProtocols (http://peak.telecommunity.com/PyProtocols.html). Protocols in a

Re: Python Equivalent to Java Interfaces?

2005-04-08 Thread Terry Hancock
On Friday 08 April 2005 11:12 pm, Brian Kazian wrote: > I want to insure that all subclasses implement a certain method, but could > not find anything that would do this for me. Is there anyway in Python to > implement this check? Thanks! I understand there are two interface implementations i

Unit tests in Leo

2005-04-08 Thread Tomi Lindberg
I'm quite (or very) new to both unit testing and Leo. I've been trying to get @test nodes to work without success so I'd like to have very simple example. So, if I have a @file with the following content... def divide_by_two(x): return x/2 ...and I'd like to write a @test node that checks wh

Python Equivalent to Java Interfaces?

2005-04-08 Thread Brian Kazian
I want to insure that all subclasses implement a certain method, but could not find anything that would do this for me. Is there anyway in Python to implement this check? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

ANNOUNCE: wxPython 2.5.5.1

2005-04-08 Thread Robin Dunn
Announcing -- I'm pleased to announce the 2.5.5.1 release of wxPython, now available for download at http://wxpython.org/download.php. This is mostly a bug-fix release, but there are a few new features as well. See the changes list below for details. What is wxPython? - wx

Re: Puzzling OO design problem

2005-04-08 Thread George Sakkis
> I'm not sure if it was clear to you, but my problem is the dummy WorldModel_v1.MovableObject class. It doesn't do anything by itself, but it has to be in the inheritance chain to make its descendants work properly. > Are you using the *_v1 naming convention for backwards compatibility? > Backw

BayPIGgies: April 14, 7:30pm (FIRST meeting at IronPort)

2005-04-08 Thread Aahz
NOTE: we are no longer meeting at Stanford; the April meeting is at IronPort in San Bruno The next meeting of BayPIGgies will be Thurs, April 14 at 7:30pm. Guido van Rossum (and any other BayPIGgies who wish to contribute) will review the activities at PyCon 2005. BayPIGgies meetings alternate

Re: Python extension performance

2005-04-08 Thread Jack Diederich
On Fri, Apr 08, 2005 at 10:14:52PM -0400, David Jones wrote: > I am trying to hunt down the difference in performance between some raw > C++ code and calling the C++ code from Python. My goal is to use Python > to control a bunch of number crunching code, and I need to show that > this will not

Re: Puzzling OO design problem

2005-04-08 Thread Jack Diederich
On Fri, Apr 08, 2005 at 06:40:54PM -0700, George Sakkis wrote: > > Err, you might want to explain what these things do instead of an > > abstract description of how you are doing it. It looks like you are > > using inheritance in the normal way _and_ you are using it to handle > > versioning of so

Re: Equivalent string.find method for a list of strings

2005-04-08 Thread jeremit0
Steven Bethard wrote: jeremit0 wrote: Steve Holden wrote: If you want line numbers,. of course, then you can use for linenum, line in enumerate(myfile.readlines()): ... Remember that true to Python's philosophy numbering will start at zero. Is this any better than: lines = myfile.readli

Python extension performance

2005-04-08 Thread David Jones
Hi, I am trying to hunt down the difference in performance between some raw C++ code and calling the C++ code from Python. My goal is to use Python to control a bunch of number crunching code, and I need to show that this will not incur a (big) performance hit. This post includes a description

Re: Equivalent string.find method for a list of strings

2005-04-08 Thread Steven Bethard
jeremit0 wrote: Steve Holden wrote: If you want line numbers,. of course, then you can use for linenum, line in enumerate(myfile.readlines()): ... Remember that true to Python's philosophy numbering will start at zero. Is this any better than: lines = myfile.readlines() for linenum

Re: Puzzling OO design problem

2005-04-08 Thread George Sakkis
> Err, you might want to explain what these things do instead of an > abstract description of how you are doing it. It looks like you are > using inheritance in the normal way _and_ you are using it to handle > versioning of some kind (maybe stable interface releases? I don't know). > > Let us kno

Re: Read 16 bit integer complex data

2005-04-08 Thread John Machin
On 7 Apr 2005 11:04:30 -0700, "Greg" <[EMAIL PROTECTED]> wrote: >That worked, thanks a lot. That's great, and given your Matlab background, you'll no doubt find lots of other uses for numeric / numarray. I'd just like to make a few other points: (1) struct.unpack shouldn't be that slow, provide

Text & Unicode processing references on the web.

2005-04-08 Thread anthony hornby
Hi, I am starting my honours degree project and part of it is going to be manipulating ASCII encoded XML files from a legacy database and converting them to Unicode and doing text processing stuff on the data. I am new to python ( total n00b ) but am keen to use it as the rest of the software my a

Re: Puzzling OO design problem

2005-04-08 Thread Jack Diederich
On Fri, Apr 08, 2005 at 04:42:52PM -0700, George Sakkis wrote: > I'm looking for a design to a problem I came across, which goes like > this (no, it's not homework): > > 1. There is a (single inheritance) hierarchy of domain classes, say > A<-B<-..<-Z (arrows point to the parent in the inheritance

Puzzling OO design problem

2005-04-08 Thread George Sakkis
I'm looking for a design to a problem I came across, which goes like this (no, it's not homework): 1. There is a (single inheritance) hierarchy of domain classes, say A<-B<-..<-Z (arrows point to the parent in the inheritance tree). 2. This hierarchy evolved over time to different versions for eac

Re: unknown encoding problem

2005-04-08 Thread John Machin
On Fri, 08 Apr 2005 15:45:35 +0200, Uwe Mayer <[EMAIL PROTECTED]> wrote: >Hi, > >I need to read in a text file which seems to be stored in some unknown >encoding. Opening and reading the files content returns: > f.read() >'\x00 \x00 \x00<\x00l\x00o\x00g\x00E\x00n\x00t\x00r\x00y\x00... > >Each

Re: sending signals to child process

2005-04-08 Thread Sarir Khamsi
"Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > Sarir Khamsi wrote: > >> I would like to start a child process (like w/ popen3(), or some such) >> and then be able to interrupt it by sending it a control-c. How do I >> do that in Python? Is there a better way to gracefully halt a child > > Use os

makepy generates empty file

2005-04-08 Thread artem . marchenko
Hi I am trying to use makepy to generate wrappers from *.tlb for examples for GoogleDesktopSearch SDK (http://desktop.google.com/downloadsdksubmit). However makepy generates only very short __init__.py and no other files. Unfortunately, I am quite new both to Python and COM and can hardly guess wh

Re: __iadd__ and __isub__ map to += and -= but don't return result

2005-04-08 Thread Anthra Norell
I see! It's the in-place aspect that led me to assume that the assignment to self inside the method would do the trick. Next the explicit call reinforced the perception. Anyway, thank you very much for the clarification. Frederic   > Anthra Norell wrote:> >> If I am missing a point here, wha

Re: base64 interoperability

2005-04-08 Thread Fredrik Lundh
Christopher J. Bottaro wrote: >>> Python's base64 module encodes and decodes differently than PHP's. >> >> really? > > Yeah, weird, huh? Actually the problem is that Python puts newlines at > every 76th char. How do I stop Python from doing that? I just want > everyone on one line. did you rea

Re: curious problem with large numbers

2005-04-08 Thread Bengt Richter
On Fri, 08 Apr 2005 10:18:05 -0700, Scott David Daniels <[EMAIL PROTECTED]> wrote: >Bengt Richter wrote: >>>Aha! Same version (2.3.4): >>> >>>Idle: >>>>>> 1e1 >>>1.0 >>>>>> import struct; struct.pack('d', 1e1) >>>'\x00\x00\x00\x00\x00\x00\xf0?' >>>(which is actually 1.0) >

Re: Equivalent string.find method for a list of strings

2005-04-08 Thread Steve Holden
jeremit0 wrote: Steve Holden wrote: jeremit0 wrote: harold fellermann wrote: file.readlines() returns a list of lines. You can either call find on each element in this list, like: for line in myfile.readlines() : if line.find('my particular string') : do_something() I had thought that

Re: Counting iterations

2005-04-08 Thread Derek Basch
ooops you are right. Should have been: pets = ["cat", "dog", "bird"] num_pets = 0 for i in pets: num_pets += 1 print "pet" + "#" + num_pets That's the problem with one offs. I don't read them :). -- http://mail.python.org/mailman/listinfo/python-list

Re: Declaring variables from a list

2005-04-08 Thread Sidharth Kuruvila
What I gave was a bad solution. Something that works right now, but probably shouldn't be done. On Apr 9, 2005 3:37 AM, Inyeol Lee <[EMAIL PROTECTED]> wrote: > On Sat, Apr 09, 2005 at 03:15:01AM +0530, Sidharth Kuruvila wrote: > > Python has a builtin function called locals which returns the local

Re: Thoughts on some stdlib modules

2005-04-08 Thread Terry Reedy
"vegetax" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > And those thoughts comes to mind again, if python is such a great > language > why does the stdlib is so bloated with duplication,bad bad library > design,clumsy to use modules,etc. Some general responses: 1. The Python lib

Re: Declaring variables from a list

2005-04-08 Thread Inyeol Lee
On Sat, Apr 09, 2005 at 03:15:01AM +0530, Sidharth Kuruvila wrote: > Python has a builtin function called locals which returns the local > context as a dictionary > > >>> locals = locals() > >>> locals["a"] = 5 > >>> a > 5 > >>> locals["a"] = "changed" > >>> a > 'changed' >From Python lib referen

ANN: Python script (for Windows) accessing motherboard sensory data

2005-04-08 Thread Claudio Grondi
Supervising motherboard sensory data as fan speeds or CPU and board temperatures in Python can be done with help of the MBM 5 utility available at http://mbm.livewiredev.com/. This utility exposes data got from the hardware sensors in a shared memory area for querying by another applications. Th

[Marshal Bug] Was Re: curious problem with large numbers

2005-04-08 Thread Michael Spencer
OK - I think this is it: My last post fingering pickle was almost but not quite right*. Actually the cuplrit is marshal, which produces the incorrect result that was noted. The bug has nothing to do with IDLE, except that it uses marshal for inter-process communication. Here's the failure cas

Re: Ply(LALR) and Yacc behaving differently

2005-04-08 Thread Åsmund Grammeltvedt
On Fri, 8 Apr 2005, Carsten Haese wrote: > On Thu, 2005-04-07 at 14:51, Åsmund Grammeltvedt wrote: > > Hi. > > > > I am trying to implement a small compiler in python and, trying to use > > something a bit more pythonic than lex/yacc, ended up with ply > > (http://systems.cs.uchicago.edu/ply/).

Re: Exception Handling

2005-04-08 Thread Joshua Ginsberg
If you use "except:" without any specific error class, it will be a catchall for any error class (including Warning and its derivatives). Otherwise you can use inheritance to refer to a group of exceptions (e.g. "except Exception:" would catch ValueError, since the ValueError class inherits fro

Re: Declaring variables from a list

2005-04-08 Thread Sidharth Kuruvila
Python has a builtin function called locals which returns the local context as a dictionary >>> locals = locals() >>> locals["a"] = 5 >>> a 5 >>> locals["a"] = "changed" >>> a 'changed' On 8 Apr 2005 13:55:39 -0700, Cactus <[EMAIL PROTECTED]> wrote: > Hi, > > If I got a list is it possible to de

Re: Exception Handling

2005-04-08 Thread Sidharth Kuruvila
Have a look at the chapter on exceptions in the python tutorial its pretty good. http://docs.python.org/tut/node10.html On 8 Apr 2005 14:29:40 -0700, SuperJared <[EMAIL PROTECTED]> wrote: > I'm new to Python, well versed in PHP and a bit of Perl. > > I've written a simple backup utility that FTPs

Re: base64 interoperability (solved)

2005-04-08 Thread Christopher J. Bottaro
Christopher J. Bottaro wrote: > > > Fredrik Lundh wrote: > >> Christopher J. Bottaro wrote: >>> Python's base64 module encodes and decodes differently than PHP's. >> >> really? > > Yeah, weird, huh? Actually the problem is that Python puts newlines at > every 76th char. How do I stop Python

Exception Handling

2005-04-08 Thread SuperJared
I'm new to Python, well versed in PHP and a bit of Perl. I've written a simple backup utility that FTPs from one server to another. I'd like to implement exception handling on the FTP should someting go wrong. This is basically what I have so far: try: ftp = FTP(ftp_host, ftp_user, ftp_pass)

Re: text processing problem

2005-04-08 Thread Leif K-Brooks
Maurice LING wrote: I'm looking for a way to do this: I need to scan a text (paragraph or so) and look for occurrences of " ()". That is, if the text just before the open bracket is the same as the text in the brackets, then I have to delete the brackets, with the text in it. How's this? import

Re: Counting iterations

2005-04-08 Thread Will McGugan
Derek Basch wrote: Is there a better way to count iterations that this?: pets = 0 for i in pets: pets += 1 print "pet" + "#" + pets You can use 'enumerate' to get the index, but the code above wont work - you are trying to iterate over a non-sequence. Will McGugan -- "".join( [ {'@':'@','

Re: Counting iterations

2005-04-08 Thread Steven Bethard
Derek Basch wrote: Is there a better way to count iterations that this?: pets = 0 for i in pets: pets += 1 print "pet" + "#" + pets for i, pet in enumerate(pets): print 'pet#%i' % (i + 1) STeVe -- http://mail.python.org/mailman/listinfo/python-list

Re: Https Form Page

2005-04-08 Thread Joshua Ginsberg
Try: import urllib2, urllib formdata = urllib.urlencode({'a':1,'b':2}) request = urllib2.Request(url) request.add_data(formdata) opener = urllib2.build_opener(urllib2.HTTPSHandler()) urllib2.install_opener(opener) fs = urllib2.urlopen(request) https_response = fs.read() https_headers = fs.info().he

Re: base64 interoperability

2005-04-08 Thread Christopher J. Bottaro
Fredrik Lundh wrote: > Christopher J. Bottaro wrote: >> Python's base64 module encodes and decodes differently than PHP's. > > really? Yeah, weird, huh? Actually the problem is that Python puts newlines at every 76th char. How do I stop Python from doing that? I just want everyone on one li

Re: Registering File Extension?!?

2005-04-08 Thread Fredrik Lundh
<[EMAIL PROTECTED]> wrote: > probably this question has been asked before, but I am unable to find > an answer... I have a big application (written in Python + a GUI in wxPython) > which allows the user to save its work in a file with an extension .glb. > Does anyone know if is there a way (on Wi

Re: Can dictionary values access their keys?

2005-04-08 Thread Terry Reedy
> Further, is there much processing required to do the magic? When python > do introspective magic, is it memory intensive? by that I mean does it > have to make copies of the objects to do the look-ups? A Python interpreter never copies *objects* (as opposed to references to objects) except whe

Counting iterations

2005-04-08 Thread Derek Basch
Is there a better way to count iterations that this?: pets = 0 for i in pets: pets += 1 print "pet" + "#" + pets Thanks, Derek Basch -- http://mail.python.org/mailman/listinfo/python-list

Re: Declaring variables from a list

2005-04-08 Thread Fredrik Lundh
"Cactus" wrote: > If I got a list is it possible to declare a variable from the items in that > list? > > Code Sample: > Blob = ['Var1', 'Var2', 'vAR3'] > i = 5 > for listitems in Blob: >i += 1 >listitems = i > > print Var1 > 6 > print Var2 > 7 > print vAR3 > 8 > > Something like that? T

Re: Equivalent string.find method for a list of strings

2005-04-08 Thread jeremit0
Steve Holden wrote: jeremit0 wrote: harold fellermann wrote: file.readlines() returns a list of lines. You can either call find on each element in this list, like: for line in myfile.readlines() : if line.find('my particular string') : do_something() I had thought that may be the only

Declaring variables from a list

2005-04-08 Thread Cactus
Hi, If I got a list is it possible to declare a variable from the items in that list? Code Sample: Blob = ['Var1', 'Var2', 'vAR3'] i = 5 for listitems in Blob: i += 1 listitems = i print Var1 6 print Var2 7 print vAR3 8 Something like that? This doesn't work (obviously) but is the

Re: Can dictionary values access their keys?

2005-04-08 Thread Terry Reedy
"Matthew Thorley" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I must say I am *very* suprised that python does not have a way to look > up what key is pointing to a given object But it does. Of course, there could be zero to many keys in any dictionary pointing to any particu

Re: Equivalent string.find method for a list of strings

2005-04-08 Thread Jack Diederich
On Fri, Apr 08, 2005 at 02:17:32PM -0400, jeremit0 wrote: > I have read a text file using the command > > lines = myfile.readlines() > > and now I want to seach those lines for a particular string. I was > hoping there was a way to "find" that string in a similar way as > searching simply a si

Re: Equivalent string.find method for a list of strings

2005-04-08 Thread jeremit0
harold fellermann wrote: file.readlines() returns a list of lines. You can either call find on each element in this list, like: for line in myfile.readlines() : if line.find('my particular string') : do_something() I had thought that may be the only way to do it, I was hoping for somet

Re: Can dictionary values access their keys?

2005-04-08 Thread Jeremy Bowers
On Fri, 08 Apr 2005 10:33:53 -0600, Matthew Thorley wrote: > I must say I am *very* suprised that python does not have a way to look > up what key is pointing to a given object--without scanning the whole > list that is. Assuming fairly optimal data structures, nothing is free. Python chooses not

Registering File Extension?!?

2005-04-08 Thread andrea_gavana
Hello NG, probably this question has been asked before, but I am unable to find an answer... I have a big application (written in Python + a GUI in wxPython) which allows the user to save its work in a file with an extension .glb. Does anyone know if is there a way (on Windows, but also on oth

Re: curious problem with large numbers - Due to subprocess

2005-04-08 Thread Scott David Daniels
Michael Spencer wrote: Problem is associated with executing iteractive input in a subprocess. >python idle.py -n IDLE 1.1 No Subprocess >>> 1e1 1.#INF >>> Really good find. _very_ curious. Perhaps moving the float causes the problem? Where does the value get converted to text

Re: Equivalent string.find method for a list of strings

2005-04-08 Thread Fredrik Lundh
"jeremit0" <[EMAIL PROTECTED]> wrote: >I have read a text file using the command > > lines = myfile.readlines() > > and now I want to seach those lines for a particular string. I was hoping > there was a way to > "find" that string in a similar way as searching simply a simple string. I > want

Re: Rotating arbitrary sets of elements within a list

2005-04-08 Thread wes weston
[EMAIL PROTECTED] wrote: I'm trying to come up with a good algorithm to do the following: Given a list 'A' to be operated on, and a list 'I' of indices into 'A', rotate the i'th elements of 'A' left or right by one position. Here's are some examples: A = [a, b, c, d, e, f] I = [0, 3, 4] rotate(A, I

Re: Can dictionary values access their keys?

2005-04-08 Thread Scott David Daniels
Matthew Thorley wrote: Scott David Daniels wrote: ...(explaining Python has no "the" parent) I see what your saying, but I my situation the values of the dictionary are unique objects created by a parent object. But that is your convention, not Python's. Some good general rules: 1) For frequent

Re: base64 interoperability

2005-04-08 Thread Fredrik Lundh
Christopher J. Bottaro wrote: > Python's base64 module encodes and decodes differently than PHP's. really? > Python's docs says that it ahere's to RFC1521 (sept 1993), while PHP's adheres > to RFC2045 (nov 1996). Is there any Python module that uses the new standard? > Why is Python using the ol

Https Form Page

2005-04-08 Thread Hasan D
I'm new on this httplib and urllib. Actually I dont know what should i use. I want to fill the form in a "https" page , and return the result . I write a test code but always gives errors. I cant find any good example about this on the net. What should I do about this ? import urlparse,urllib,ht

Re: Equivalent string.find method for a list of strings

2005-04-08 Thread Joshua Ginsberg
try: filter(lambda x: lines[x].find(searchstring) != -1, range(len(lines))) That will return a list with the indices of every line containing a hit for your search string. -jag <>Joshua Ginsberg -- [EMAIL PROTECTED] Brainstorm Internet Network Operations 970-247-1442 x131 On Apr 8, 2005, at 1:52

Re: problem saving tif files with PIL

2005-04-08 Thread Fredrik Lundh
"mchl gdbt" <[EMAIL PROTECTED]> wrote: > Ideally, I want the output image to be identical to the original in every > way. I suspect that it > might be enough to just change the size numbers though I don't know how. I > will be messing around > with the pixel colours eventually but the struct

Re: curious problem with large numbers - Due to subprocess - using pickle

2005-04-08 Thread Michael Spencer
Michael Spencer wrote: Problem is associated with executing iteractive input in a subprocess. >python idle.py -n IDLE 1.1 No Subprocess >>> 1e1 1.#INF >>> Michael It seems that the culprit is pickle - used to send messages between the IDLE shell and the execution server. >

Re: Equivalent string.find method for a list of strings

2005-04-08 Thread Steve Holden
jeremit0 wrote: harold fellermann wrote: file.readlines() returns a list of lines. You can either call find on each element in this list, like: for line in myfile.readlines() : if line.find('my particular string') : do_something() I had thought that may be the only way to do it, I was

Re: Can dictionary values access their keys?

2005-04-08 Thread Bengt Richter
On Fri, 08 Apr 2005 09:30:25 -0600, Matthew Thorley <[EMAIL PROTECTED]> wrote: >This may be a very rudimentary question, but here goes: > >If I have a simple dictionary, where the value is a class or function, >is there an interface through which it can discover what its key is? >Similar to index(

Re: Equivalent string.find method for a list of strings

2005-04-08 Thread Joshua Ginsberg
Try: filter(lambda x: x.find(searchstring) != -1, lines) <>Joshua Ginsberg -- [EMAIL PROTECTED] Brainstorm Internet Network Operations 970-247-1442 x131 On Apr 8, 2005, at 12:17 PM, jeremit0 wrote: I have read a text file using the command lines = myfile.readlines() and now I want to seach those l

problem saving tif files with PIL

2005-04-08 Thread mchl gdbt
Hi, I have several thousand tiffs generated by application A which are read by application B. I need to remove a few colours from the tiffs and I decided to try with the python imaging library. Running under debug mode permits saving my tiff files (with Image.DEBUG=0, the save doesn't work! see

Re: Equivalent string.find method for a list of strings

2005-04-08 Thread harold fellermann
I have read a text file using the command lines = myfile.readlines() and now I want to seach those lines for a particular string. I was hoping there was a way to "find" that string in a similar way as searching simply a simple string. I want to do something like lines.find.('my particular stri

Re: Interpreter problem

2005-04-08 Thread rbt
Steve Holden wrote: rbt wrote: Steve Holden wrote: rbt wrote: Steve Holden wrote: Greg Lindstrom wrote: I am using python 2.3.5 on a Linux system and have an odd problem dealing with the 'sha-bang' line. I have a file, driver.py which starts with #!/usr/bin/python and works fine (that is, when

Equivalent string.find method for a list of strings

2005-04-08 Thread jeremit0
I have read a text file using the command lines = myfile.readlines() and now I want to seach those lines for a particular string. I was hoping there was a way to "find" that string in a similar way as searching simply a simple string. I want to do something like lines.find.('my particular stri

Re: curious problem with large numbers - Due to subprocess

2005-04-08 Thread Michael Spencer
Scott David Daniels wrote: Scott David Daniels wrote: Bengt Richter wrote: Aha! Same version (2.3.4): Idle: >>> 1e1 1.0 >>> import struct; struct.pack('d', 1e1) '\x00\x00\x00\x00\x00\x00\xf0?' (which is actually 1.0) python via command line (readline support): >>> 1e1

Re: sending signals to child process

2005-04-08 Thread Diez B. Roggisch
Sarir Khamsi wrote: > I would like to start a child process (like w/ popen3(), or some such) > and then be able to interrupt it by sending it a control-c. How do I > do that in Python? Is there a better way to gracefully halt a child Use os.kill and the signal module. > process? Is there a more

Re: unknown encoding problem

2005-04-08 Thread Leif K-Brooks
Uwe Mayer wrote: Hi, I need to read in a text file which seems to be stored in some unknown encoding. Opening and reading the files content returns: f.read() '\x00 \x00 \x00<\x00l\x00o\x00g\x00E\x00n\x00t\x00r\x00y\x00... Each character has a \x00 prepended to it. I suspect its some kind of unicod

Re: Can dictionary values access their keys?

2005-04-08 Thread Matthew Thorley
Steve Holden wrote: > Indeed, they will probably just need to pass "self" as an argument to > the child object's creator (it will become an argument to the __init__() > method). This will be pretty cheap, since the additional attribute will > be bound to an already-existing value. > >> On the oth

Re: base64 interoperability

2005-04-08 Thread Christopher J. Bottaro
Christopher J. Bottaro wrote: > Python's base64 module encodes and decodes differently than PHP's. > Python's docs says that it ahere's to RFC1521 (sept 1993), while PHP's > adheres to > RFC2045 (nov 1996). Is there any Python module that uses the new > standard? Why is Python using the old stan

base64 interoperability

2005-04-08 Thread Christopher J. Bottaro
Python's base64 module encodes and decodes differently than PHP's. Python's docs says that it ahere's to RFC1521 (sept 1993), while PHP's adheres to RFC2045 (nov 1996). Is there any Python module that uses the new standard? Why is Python using the old standard anyways? Thanks. -- http://mail.

Re: Can dictionary values access their keys?

2005-04-08 Thread Steve Holden
Matthew Thorley wrote: Steve Holden wrote: I think that since each Datapoint appears to be unique, the simplest thing to do is to include a reference to the parent object as an attribute of the datapoint. Presumably when you create the Datapoint you already know which Device and Mib it's going to

sending signals to child process

2005-04-08 Thread Sarir Khamsi
I would like to start a child process (like w/ popen3(), or some such) and then be able to interrupt it by sending it a control-c. How do I do that in Python? Is there a better way to gracefully halt a child process? Is there a more cross-platform way to start a child process (popen() is only on UN

Re: curious problem with large numbers

2005-04-08 Thread Scott David Daniels
Scott David Daniels wrote: Bengt Richter wrote: Aha! Same version (2.3.4): Idle: >>> 1e1 1.0 >>> import struct; struct.pack('d', 1e1) '\x00\x00\x00\x00\x00\x00\xf0?' (which is actually 1.0) python via command line (readline support): >>> 1e1 1.#INF >>> import struct

Re: Can dictionary values access their keys?

2005-04-08 Thread Matthew Thorley
Steve Holden wrote: > I think that since each Datapoint appears to be unique, the simplest > thing to do is to include a reference to the parent object as an > attribute of the datapoint. Presumably when you create the Datapoint you > already know which Device and Mib it's going to be stored in, s

Re: Can dictionary values access their keys?

2005-04-08 Thread Max M
Matthew Thorley wrote: I am creating an object database to store information about network devices, e.g. switches and routers. Possible usefull pages? http://www.python.org/doc/essays/graphs.html more at: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/119466 -- hilsen/regards Max M, Denma

Re: Can dictionary values access their keys?

2005-04-08 Thread Steve Holden
Matthew Thorley wrote: Steve Holden wrote: while not impossible (using Python's excellent introspection facilities) is way beyond what most people would consider practical. Obviously the garbage collector has to solve this problem, but you *really* don't want to be doing this stuff in Python unless

Re: Can dictionary values access their keys?

2005-04-08 Thread Matthew Thorley
Scott David Daniels wrote: > Matthew Thorley wrote: > >> This may be a very rudimentary question, but here goes: > > From your questions, I believe you are not thinking of values as > being distinct from the names and data structures that refer to them. > > What is the parent of 23 in the follow

Re: curious problem with large numbers

2005-04-08 Thread Michael Spencer
Scott David Daniels wrote: Steve Holden wrote: Scott David Daniels wrote: Terry Reedy wrote: On my Windows machine with 2.2.1, I get exactly what you expected: 1e1 1.#INF ... If you get wrong behavior on a later version, then a bug has been introduced somewhere, even perhaps in VC 7, used for

Re: Can dictionary values access their keys?

2005-04-08 Thread Matthew Thorley
Steve Holden wrote: while not impossible (using Python's excellent > introspection facilities) is way beyond what most people would consider > practical. Obviously the garbage collector has to solve this problem, > but you *really* don't want to be doing this stuff in Python unless you > absolutely

Re: Interpreter problem

2005-04-08 Thread Ivan Van Laningham
Hi All-- Steve Holden wrote: > > > It's odd that deleting the line and reentering it on the Linux box did > > not correct the problem. Perhaps vim recognized the format as having > > cr-lf and inserted it even though I was editing on Linux. > > > > Anyhow, it would have been a long time before I

Re: Installing Python 2.4 on Linux

2005-04-08 Thread Edward Diener
Joseph Garvin wrote: Another solution is to just install 2.4 and then make an alias for yum='/usr/bin/python2.3 yum' or whatever the path is :) If it were just 'yum' under Fedora 3, I could probably do that but looking at the dependencies on the python2.3 package in Synaptic there must be about 5

Re: Ply(LALR) and Yacc behaving differently

2005-04-08 Thread Carsten Haese
On Thu, 2005-04-07 at 14:51, Åsmund Grammeltvedt wrote: > Hi. > > I am trying to implement a small compiler in python and, trying to use > something a bit more pythonic than lex/yacc, ended up with ply > (http://systems.cs.uchicago.edu/ply/). The only problem is that whereas > yacc accepts the

Re: curious problem with large numbers

2005-04-08 Thread Scott David Daniels
Bengt Richter wrote: Aha! Same version (2.3.4): Idle: >>> 1e1 1.0 >>> import struct; struct.pack('d', 1e1) '\x00\x00\x00\x00\x00\x00\xf0?' (which is actually 1.0) python via command line (readline support): >>> 1e1 1.#INF >>> import struct; struct.pack('d', 1e1)

Re: redirect stdout

2005-04-08 Thread Fredrik Lundh
Neal Becker wrote: > I'd like to build a module that would redirect stdout to send it to a logging > module. I want to be able to use a python module that expects to print > results using "print" or "sys.stdout.write()" and without modifying that > module, be able to redirect it's stdout to a log

Re: __iadd__ and __isub__ map to += and -= but don't return result

2005-04-08 Thread Fredrik Lundh
Anthra Norell wrote: > If I am missing a point here, what could it be? the documentation? > class Vertex (list): >def __init__ (self, *coordinates): self [:] = list (coordinates [0:2]) >def __add__ (self, V): return Vertex (self [X] + V [X], self [Y] + V [Y]) >def __iadd__ (self, V)

Re: Can dictionary values access their keys?

2005-04-08 Thread Axel Straschil
Hello! > thousands more entries. So we're talking about maybe a million+ total > nested key:values. I don't know if that counts as large or not. I can't > even guess how much k memory that is. Mhh, maybe you should use a SQL-Database ;-) Lg, AXEL. -- "Aber naja, ich bin eher der Forentyp." Wolf

Re: THE GREATEST NEWS EVER ! °º¤ø,¸¸,ø¤º°`°º¤ø°º¤ø,¸¸,ø¤º°`°º¤ø°º¤ø,¸¸,ø¤º°`°º¤ø°º¤ø,¸¸,ø¤º°`°º¤ø°º¤ø,¸¸,ø¤º°`°º¤ø°º¤ø,¸¸,ø¤º°`°º¤ø°º¤ø,¸¸,ø¤º°`°º¤ø°º¤ø,¸¸,ø¤º°`°º¤ø°º¤ø,¸¸,ø¤º°`°º¤ø°º¤ø,¸¸,ø¤º°`°º¤ø°º¤ø,¸¸,ø¤º°`°º¤ø

2005-04-08 Thread Scott M.
>From your site: "The reason some people don't know for sure if they are going to Heaven when they die is because they just don't know." Isn't that like saying the reason I'm not a rocket scientist is because I'm not a rocket scientist? <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTEC

Re: curious problem with large numbers

2005-04-08 Thread Bengt Richter
On Fri, 08 Apr 2005 09:05:39 -0700, Scott David Daniels <[EMAIL PROTECTED]> wrote: >Steve Holden wrote: >> Scott David Daniels wrote: >> >>> Terry Reedy wrote: >>> On my Windows machine with 2.2.1, I get exactly what you expected: >>> 1e1 1.#INF ... If you g

Re: Testing that a value is set.

2005-04-08 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: >I am using winGuiAuto to test a program. I want to check that a > varible is set. > > In the following code I am doing if(len(str(hwnd)) < 0) What is the > python way? you're expecting a string with negative length? that's pretty weird. what language uses that mechan

  1   2   >