Re: using python to parse md5sum list

2005-03-07 Thread TZOTZIOY
On 5 Mar 2005 19:54:34 -0800, rumours say that [EMAIL PROTECTED] (Ben Rf) might have written: [snip] >the end end goal is to have a way of finding duplicate files that are >scattered across a lan of 4 windows computers. Just in case you want to go directly to that goal, check this: http://group

HELP: Python & Tkinter ?

2005-03-07 Thread PGMoscatt
Hi all, Have just installed Fedora 3 and wish also want to give programming with Python a go. I wish to develop GUI interfaces and believe that 'Tkinter' is the way to go. After installing Python frpm the distro CD I can't use the 'from Tkinter import *' command. When I try, I get the error mess

Re: IndexedCatalog and ZEO

2005-03-07 Thread Almad
Leif K-Brooks wrote: > from IndexedCatalog.Shelf import Shelf > shelf = Shelf(('localhost', 1234), [Class1, Class2]) Thanks, that is what I was searching for. -- Lukas "Almad" Linhart [:: http://www.almad.net/ ::] [:: Humans are too complicated to be described with words. ::] [:: PGP/GNUPg key

Re: Python & Tkinter ?

2005-03-07 Thread Fredrik Lundh
"PGMoscatt" wrote: > Have just installed Fedora 3 and wish also want to give programming with > Python a go. I wish to develop GUI interfaces and believe that 'Tkinter' > is the way to go. > > After installing Python frpm the distro CD I can't use the 'from Tkinter > import *' command. When I try

Re: HELP: Python & Tkinter ?

2005-03-07 Thread TZOTZIOY
On Mon, 07 Mar 2005 18:19:16 +1000, rumours say that PGMoscatt <[EMAIL PROTECTED]> might have written: >Hi all, > >Have just installed Fedora 3 and wish also want to give programming with >Python a go. I wish to develop GUI interfaces and believe that 'Tkinter' >is the way to go. [snip: import T

Mail System Error - Returned Mail

2005-03-07 Thread remove
The original message was included as attachment test; hi; hello; Mail Delivery System; Mail Transaction Failed; Server Report; Status; Error; Test; Hi; Hello; Encrypted Mail; Virus sample; abuse?; feel free to use it; Excel file; Details; fake; read it immediately; something for you; informatio

Re: How do I import everything in a subdir?

2005-03-07 Thread Cyril BAZIN
Hello, If you want to look for the files "*.py" in a directory, don't use shell command!!! You have many ways to access the content of a directory in Python. For exemple, you can use the glob module: >>> import glob >>> glob.glob('./[0-9].*') ['./1.gif', './2.txt'] >>> glob.glob('*.gif') ['1.gif

Re: Python & Tkinter ?

2005-03-07 Thread PGMoscatt
Fredrik Lundh wrote: > "PGMoscatt" wrote: > >> Have just installed Fedora 3 and wish also want to give programming with >> Python a go. I wish to develop GUI interfaces and believe that 'Tkinter' >> is the way to go. >> >> After installing Python frpm the distro CD I can't use the 'from Tkinter

Re: Possible to import a module whose name is contained in a variable?

2005-03-07 Thread Claudio Grondi
STeVe, may I ask you for more details on this? Any disadvantages while using exec() in this context? I try to avoid using any of the ____() functions if possible (considering this a good programming style). Claudio "Steven Bethard" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROT

Re: Possible to import a module whose name is contained in a variable?

2005-03-07 Thread Heiko Wundram
On Monday 07 March 2005 11:52, Claudio Grondi wrote: > I try to avoid using any of the > ____() functions if possible > (considering this a good > programming style). This is never good style, at least in the case of exec. exec is evil. What works (beware that the below code is nevertheless u

mxDateTime on Mac: Fatal Python Error

2005-03-07 Thread contact
I'm trying to get mxDateTime working on a Mac so that I can use pyscopg and cx_Oracle. The Egenix base package builds and installs quite happily, but then when I try to import it I get >> import mx.DateTime Fatal Python error: Interpreter not initialized (version mismatch?) Abort ... any ideas?

Re: Possible to import a module whose name is contained in a variable?

2005-03-07 Thread Michael Hoffman
Claudio Grondi wrote: STeVe, may I ask you for more details on this? Any disadvantages while using exec() in this context? I try to avoid using any of the ____() functions if possible (considering this a good programming style). Avoiding exec (which is a statement, not a function) is much more

Re: GOTO (was Re: Appeal for python developers)

2005-03-07 Thread Heiko Wundram
On Sunday 06 March 2005 14:26, Anthra Norell wrote: > Wow, I never thought I'd say this, but this certainly is an ingenious use of goto... But, nevertheless, I don't think this is applicable to Python as a way of justifying goto in the language, as your program doesn't have a split between abs

win32com and Python2.4: Interpreter crashing!

2005-03-07 Thread Tim N. van der Leeuw
Hi, When trying to use win32com functionality with Python2.4, the interpreter often crashes! I don't know if it's a known problem already that will be fixed in an upcoming Python2.4.1 version. Basically, the problem is: makepy.py generates a (large, nearly 2mb) Python file for use with COM inter

re - Question about pyFMOD importing

2005-03-07 Thread lior botzer
Dear Tian,   perhaps you might be able to assit me. I've seen your question regarding pyMod importing   http://mail.python.org/pipermail/python-list/2005-February/263969.html   I'm using a different module (something to do with paralell port) but after installing my modules I get the same erro

Re: Modifying Call Tips and Intellisense Behavior

2005-03-07 Thread Szabolcs Nagy
have a look at eclipse + pyDev http://pydev.sourceforge.net/ probably it works as you wish -- http://mail.python.org/mailman/listinfo/python-list

resources

2005-03-07 Thread shield0092005
hi i'v been searching 4 resources ,and study materials on PYTHON.If any body has some suggestion for getting ebooks ,pdf,or tutorials kindly let me know. thankyou -- http://mail.python.org/mailman/listinfo/python-list

reversed heapification?

2005-03-07 Thread Stefan Behnel
Hi! I need a general-purpose best-k sorting algorithm and I'd like to use heapq for that (heapify + heappop*k). The problem is that heapify and heappop do not support the "reverse" keyword as known from sorted() and list.sort(). While the decorate-sort-undecorate pattern allows me to replace the "k

Re: reversed heapification?

2005-03-07 Thread Kent Johnson
Stefan Behnel wrote: Hi! I need a general-purpose best-k sorting algorithm and I'd like to use heapq for that (heapify + heappop*k). The problem is that heapify and heappop do not support the "reverse" keyword as known from sorted() and list.sort(). While the decorate-sort-undecorate pattern allow

Re: reversed heapification?

2005-03-07 Thread Stefan Behnel
Kent Johnson schrieb: heapq.nlargest() heapq.nsmallest() ? Python 2.4 only Thanks! Those are *very* well hidden in the documentation. Maybe I already read that page too often... Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: re - Question about pyFMOD importing

2005-03-07 Thread Heiko Wundram
On Tuesday 08 March 2005 12:38, lior botzer wrote: > Were you able to hack this one ? I haven't seen this error in a long time (as I'm no Windows user for a long time), but from what I gather the only thing that the specified error was telling you is the fact that the dynamic linking library tha

os.system()

2005-03-07 Thread Joerg Schuster
Hello, code like os.system(command) only works for some values of 'command' on my system (Linux). A certain shell command (that *does* run on the command line) does not work when called with os.system(). Does anyone know a simple and stable way to have *any* string executed by the shell? Jörg S

Re: reversed heapification?

2005-03-07 Thread Stefan Behnel
Kent Johnson wrote: heapq.nlargest() heapq.nsmallest() On second thought, that doesn't actually get me very far. I do not know in advance how many I must select since I need to remove duplicates *after* sorting (they are not necessarily 'duplicate' enough to fall into the same sort bucket). What

Re: os.system()

2005-03-07 Thread Diez B. Roggisch
> only works for some values of 'command' on my system (Linux). A certain > shell command (that *does* run on the command line) does not work when > called with os.system(). Does anyone know a simple and stable way to > have *any* string executed by the shell? Showing us what commands actually fai

Re: os.system()

2005-03-07 Thread Joerg Schuster
Well, I can give you the string, but that will not help: transduce abc info_dic comp_dic input_file output_file For copy right reasons, I am not allowed to give you the program transduce. But here are some facts about transduce: - it is written in C - it takes an alphabet file (abc) and two aut

Re: os.system()

2005-03-07 Thread Heiko Wundram
On Monday 07 March 2005 14:10, Diez B. Roggisch wrote: > Showing us what commands actually fail would certainly help. Actually, this sounds like the subshell isn't getting an alias that the normal interactive shell has. Maybe because ~/.bashrc isn't read on os.system(), or something of the like?

Re: Possible to import a module whose name is contained in a variable?

2005-03-07 Thread Ed Leafe
On Mar 7, 2005, at 5:23 AM, Michael Hoffman wrote: Avoiding exec (which is a statement, not a function) is much more important. Since it executes arbitrary code, you can get unpredictable results from it. Is there any way to use __import__ to replace the following: exec("from %s import *" % mod

PyAr - Python Argentina 7th Meeting, this Thursday

2005-03-07 Thread Batista, Facundo
Title: PyAr - Python Argentina 7th Meeting, this Thursday The Argentine Python User Group, PyAr, will have its seventh meeting this Thursday, January 10th at 7:00pm. Agenda -- Despite our agenda tends to be rather open, this time we would like to cover these topics: - See how the c

Re: convert gb18030 to utf16

2005-03-07 Thread Xah Lee
Truely superb! Thanks! Xah [EMAIL PROTECTED] http://xahlee.org/ [EMAIL PROTECTED] wrote: > Xah Lee <[EMAIL PROTECTED]> wrotE: > > > i have a bunch of files encoded in GB18030. Is there a way to convert > > them to utf16 with python? > > You will need CJKCodecs (http://cjkpython.i18n.org/),

Re: os.system()

2005-03-07 Thread Joerg Schuster
> Several variables like PATH "normally" get reset even when > running a non-login subshell It seems that this has been the problem. I guess your tip saved me a lot of time. Thanks a lot. Joerg -- http://mail.python.org/mailman/listinfo/python-list

Re: Possible to import a module whose name is contained in a variable?

2005-03-07 Thread Gerrit Holl
Ed Leafe wrote: > On Mar 7, 2005, at 5:23 AM, Michael Hoffman wrote: > >Avoiding exec (which is a statement, not a function) is much more > >important. Since it executes arbitrary code, you can get unpredictable > >results from it. > > Is there any way to use __import__ to replace the follow

Re: reversed heapification?

2005-03-07 Thread Kent Johnson
Stefan Behnel wrote: Kent Johnson wrote: heapq.nlargest() heapq.nsmallest() On second thought, that doesn't actually get me very far. I do not know in advance how many I must select since I need to remove duplicates *after* sorting (they are not necessarily 'duplicate' enough to fall into the s

Re: os.system()

2005-03-07 Thread Joerg Schuster
> Several variables like PATH "normally" get reset even when > running a non-login subshell It seems that this has been the problem. I guess your tip saved me a lot of time. Thanks a lot. Joerg -- http://mail.python.org/mailman/listinfo/python-list

Re: Unable to run IDLE Under Windows

2005-03-07 Thread maxwell
Thanks, guess I misunderstood--I thought "pythonw" _was_ IDLE. Now I see what IDLE is, and I wasn't actually wanting to run that. And as it turns out, my _real_ problem was that my path was making me run the CygWin version of Python from the "DOS" command prompt--which understandably dies with a

Re: resources

2005-03-07 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, shield0092005 <[EMAIL PROTECTED]> wrote: > >hi >i'v been searching 4 resources ,and study materials on PYTHON.If any >body has some suggestion for getting ebooks ,pdf,or tutorials kindly >let me know. >thankyou > > > If your search did not encounter http://python

shuffle the lines of a large file

2005-03-07 Thread Joerg Schuster
Hello, I am looking for a method to "shuffle" the lines of a large file. I have a corpus of sorted and "uniqed" English sentences that has been produced with (1): (1) sort corpus | uniq > corpus.uniq corpus.uniq is 80G large. The fact that every sentence appears only once in corpus.uniq plays a

Re: reversed heapification?

2005-03-07 Thread Jeff Epler
Can you use something like (untested) class ComparisonReverser: def __init__(self, s): self.s = s def __cmp__(self, o): return cmp(o, self.s) def __lt__... # or whichever operation hashes use then use (ComparisonReverser(f(x)), i, x) as the decorated item instead of (f(

Re: shuffle the lines of a large file

2005-03-07 Thread Kent Johnson
Joerg Schuster wrote: Hello, I am looking for a method to "shuffle" the lines of a large file. I have a corpus of sorted and "uniqed" English sentences that has been produced with (1): (1) sort corpus | uniq > corpus.uniq corpus.uniq is 80G large. The fact that every sentence appears only once in c

RE: shuffle the lines of a large file

2005-03-07 Thread Alex Stapleton
Not tested this, run it (or some derivation thereof) over the output to get increasing randomness. You will want to keep max_buffered_lines as high as possible really I imagine. If shuffle() is too intensize you could itterate over the buffer several times randomly removing and printing lines unti

Re: os.system()

2005-03-07 Thread Heiko Wundram
On Monday 07 March 2005 14:24, Joerg Schuster wrote: > Well, I can give you the string, but that will not help: > > transduce abc info_dic comp_dic input_file output_file Several variables like PATH "normally" get reset even when running a non-login subshell to the standard values from /etc/profi

Re: shuffle the lines of a large file

2005-03-07 Thread Heiko Wundram
On Monday 07 March 2005 14:36, Joerg Schuster wrote: > Any ideas? The following program should do the trick (filenames are hardcoded, look at top of file): ### shuffle.py import random import shelve # Open external files needed for data storage. lines = open("test.dat","r") lineindex = shelve.

Re: shuffle the lines of a large file

2005-03-07 Thread Eddie Corns
"Joerg Schuster" <[EMAIL PROTECTED]> writes: >Hello, >I am looking for a method to "shuffle" the lines of a large file. >I have a corpus of sorted and "uniqed" English sentences that has been >produced with (1): >(1) sort corpus | uniq > corpus.uniq >corpus.uniq is 80G large. The fact that eve

RE: shuffle the lines of a large file

2005-03-07 Thread Alex Stapleton
Woops typo. else: buffer.shuffle() for line in buffer: print line should be else: random.shuffle(buffer) for line in buffer: print line of course -Original Messag

Re: reversed heapification?

2005-03-07 Thread Stefan Behnel
Jeff Epler wrote: Can you use something like (untested) class ComparisonReverser: def __init__(self, s): self.s = s def __cmp__(self, o): return cmp(o, self.s) def __lt__... # or whichever operation hashes use then use (ComparisonReverser(f(x)), i, x) as the decorated i

Re: shuffle the lines of a large file

2005-03-07 Thread Heiko Wundram
Replying to oneself is bad, but although the program works, I never intended to use a shelve to store the data. Better to use anydbm. So, just replace: import shelve by import anydbm and lineindex = shelve.open("test.idx") by lineindex = anydbm.open("test.idx","c") Keep the rest as is.

Re: os.system()

2005-03-07 Thread gene . tani
mod subprocess, if you're on 2.4: http://docs.python.org/whatsnew/node8.html -- http://mail.python.org/mailman/listinfo/python-list

Re: shuffle the lines of a large file

2005-03-07 Thread Richard Brodie
"Joerg Schuster" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I am looking for a method to "shuffle" the lines of a large file. Of the top of my head: decorate, randomize, undecorate. Prepend a suitable large random number or hash to each line and then use sort. You could prepen

Re: os.system()

2005-03-07 Thread Nick Craig-Wood
Joerg Schuster <[EMAIL PROTECTED]> wrote: > os.system(command) > > only works for some values of 'command' on my system (Linux). A certain > shell command (that *does* run on the command line) does not work when > called with os.system(). Does anyone know a simple and stable way to > have *an

Re: Appeal for python developers

2005-03-07 Thread Lars
Boogieman wrote: > Please include "goto" command in future python realeses > I know that proffesional programers doesn't like to use it, > but for me as newbie it's too hard to get used replacing it > with "while", "def" or other commands I'm assuming you mean "python releases", "professional prog

Re: Possible to import a module whose name is contained in a variable?

2005-03-07 Thread Peter Hansen
Gerrit Holl wrote: Ed Leafe wrote: On Mar 7, 2005, at 5:23 AM, Michael Hoffman wrote: Avoiding exec (which is a statement, not a function) is much more important. Since it executes arbitrary code, you can get unpredictable results from it. Is there any way to use __import__ to replace the follo

Re: shuffle the lines of a large file

2005-03-07 Thread gry
As far as I can tell, what you ultimately want is to be able to extract a random ("representative?") subset of sentences. Given the huge size of data, I would suggest not randomizing the file, but randomizing accesses to the file. E.g. (sorry for off-the-cuff pseudo python): [adjust 8196 == 2**13

Re: Possible to import a module whose name is contained in a variable?

2005-03-07 Thread Michael Hoffman
Ed Leafe wrote: Is there any way to use __import__ to replace the following: exec("from %s import *" % modulename) I shouldn't do this but: module = __import__(modulename) try: for key in module.__all__: globals()[key] = module[key] except AttributeError: globals().update(module

Re: os.system()

2005-03-07 Thread Richie Hindle
[Nick] > $ ps axf > 5121 ?S 0:00 rxvt > 5123 pts/77 Ss 0:00 \_ bash > 5126 pts/77 S+ 0:00 \_ python > 5149 pts/77 S+ 0:00 \_ sh -c sleep 60 > z > 5150 pts/77 S+ 0:00 \_ sleep 60 Wow, good feature of ps - thanks for the educatio

Re: shuffle the lines of a large file

2005-03-07 Thread Warren Postma
Joerg Schuster wrote: Unfortunately, none of the machines that I may use has 80G RAM. So, using a dictionary will not help. Any ideas? Why don't you index the file? I would store the byte-offsets of the beginning of each line into an index file. Then you can generate a random number from 1 to Wh

Re: shuffle the lines of a large file - filelist.py (0/1)

2005-03-07 Thread TZOTZIOY
On 7 Mar 2005 05:36:32 -0800, rumours say that "Joerg Schuster" <[EMAIL PROTECTED]> might have written: >Hello, > >I am looking for a method to "shuffle" the lines of a large file. [snip] >So, it would be very useful to do one of the following things: > >- produce corpus.uniq in a such a way tha

MDaemon Warning - virus found: Returned mail: see transcript for details

2005-03-07 Thread Automatic Email Delivery Software
*** WARNING ** Este mensaje ha sido analizado por MDaemon AntiVirus y ha encontrado un fichero anexo(s) infectado(s). Por favor revise el reporte de abajo. AttachmentVirus name Action taken ---

Re: Can a method in one class change an object in another class?

2005-03-07 Thread [EMAIL PROTECTED]
thanks guys. Three good answers, each slightly different, but giving me good food for thought. Obviously my example was a trivial one, but I wanted to isolate the behaviour I'm seeing in my real app. I now have some good ideas for moving forward! cheers S -- http://mail.python.org/mailman/lis

Re: parsing a date string

2005-03-07 Thread Thomas Guettler
Am Sun, 06 Mar 2005 19:35:23 + schrieb MikeyG: > Hi, > > I have a date string in the ctime() format ('Sat Mar 5 10:38:07 2005') > and I want to know how long ago that was in whole days. > > So far I have: > > import time > import datetime > age = > (datetime.date.fromtimestamp(time.mktim

Re: Python & Tkinter ?

2005-03-07 Thread Fredrik Lundh
Pete wrote: > Never seen this YUM thing but it's pretty trick. more here: http://linux.duke.edu/projects/yum/ -- http://mail.python.org/mailman/listinfo/python-list

Re: intigrate the PyGame module with my Python

2005-03-07 Thread Warren Postma
1. Downloaded the windows binary for python 1.5.2 from python.org. Pygame uses Python 1.5.2 still!? :-) Oi. Warren -- http://mail.python.org/mailman/listinfo/python-list

Re: Geneator/Iterator Nesting Problem - Any Ideas? 2.4

2005-03-07 Thread ChaosKCW
For those that are interested I ran a performance comparison of various functions for wrapping sql results in a interables and generators. The results are below and the code is at the very bottom. Surprisinly (in a happy way) the functional version of the batch retrieve comes in a very close secon

Re: intigrate the PyGame module with my Python

2005-03-07 Thread Dave Brueck
Warren Postma wrote: 1. Downloaded the windows binary for python 1.5.2 from python.org. Pygame uses Python 1.5.2 still!? :-) Oi. Nah, must have been a typo, as www.pygame.org lists Windows installers for Python 2.2, 2.3, and 2.4: http://www.pygame.org/download.shtml -Dave -- http://mail.python.

Re: Python 2.4 removes None data type?

2005-03-07 Thread Warren Postma
Michael Hoffman wrote: The fact that True and False are not constants? Yowza. a = True b = False False = a True = b if (1==2)==True: print "Doom" -- http://mail.python.org/mailman/listinfo/python-list

Re: bsddb for k, v in db.items(): do order the numbers ?

2005-03-07 Thread martijn
uhm i'm trying to make a very simple but large database: Let's say I want these fields : |name|age|country| Then I can't do this because I use the same key db["name"] = 'piet' db["age"] = '20' db["country"] = 'nl' #same keys so it wil overwrite db["name"] = 'jan' db["age"] = '40' db["country

Re: Geneator/Iterator Nesting Problem - Any Ideas? 2.4

2005-03-07 Thread Peter Otten
ChaosKCW wrote: > def resultset_functional_generator(cursor): > for rec in iter(lambda: cursor.fetchone(), None): > yield rec This can be simplified to def resultset_functional_generator(cursor): return iter(cursor.fetchone, None) It should be a bit faster, too. Peter -- htt

Re: Python 2.4 removes None data type?

2005-03-07 Thread Warren Postma
Michael Hoffman wrote: The fact that True and False are not constants? Yowza. a = True b = False False = a True = b if (1==2)==True: print "Doom" -- http://mail.python.org/mailman/listinfo/python-list

Re: Ruby on Rails or Perl's Maypole..is there a Python equivalent

2005-03-07 Thread Gary Nutbeam
John J. Lee wrote: I know mono runs on linux but I want nothing to do with it unless absolutely necessary. > Gary Nutbeam <[EMAIL PROTECTED]> writes: >> D H wrote: > [...] >> > Check out Castle on Rails for .NET/Mono. It is still in early >> > development, but you can use it with C#, VB, or boo,

Re: Ruby on Rails or Perl's Maypole..is there a Python equivalent

2005-03-07 Thread Gary Nutbeam
Learning Ruby to use Rails is tempting. Iwan van der Kleyn wrote: > Gary Nutbeam wrote: >> needing to learn Ruby. > > But why wouldn't you just use Rails and learn Ruby in the process? The > "effort" required to learn Ruby pales in comparisson to the advantages > using Ruby on Rails might give y

Re: shuffle the lines of a large file

2005-03-07 Thread Joerg Schuster
Thanks to all. This thread shows again that Python's best feature is comp.lang.python. Jörg -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.4 removes None data type?

2005-03-07 Thread Steven Bethard
Warren Postma wrote: Michael Hoffman wrote: The fact that True and False are not constants? Yowza. a = True b = False False = a True = b if (1==2)==True: print "Doom" Why stop there when you can really cause some doom: py> import __builtin__ as bltin py> bltin.True, bltin.False = bltin.False, b

Re: shuffle the lines of a large file

2005-03-07 Thread Steven Bethard
Joerg Schuster wrote: Thanks to all. This thread shows again that Python's best feature is comp.lang.python. +1 QOTW STeVe -- http://mail.python.org/mailman/listinfo/python-list

RE: shuffle the lines of a large file

2005-03-07 Thread Batista, Facundo
Title: RE: shuffle the lines of a large file [Joerg Schuster] #- Thanks to all. This thread shows again that Python's best feature is #- comp.lang.python. QOTW! QOTW! .    Facundo Bitácora De Vuelo: http://www.taniquetil.com.ar/plog PyAr - Python Argentina: http://pyar.decode.com.ar/

Re: bsddb for k, v in db.items(): do order the numbers ?

2005-03-07 Thread Ulf Göransson
[EMAIL PROTECTED] wrote: uhm i'm trying to make a very simple but large database: Let's say I want these fields : |name|age|country| Then I can't do this because I use the same key db["name"] = 'piet' db["age"] = '20' db["country"] = 'nl' #same keys so it wil overwrite db["name"] = 'jan' db["ag

Catching all methods before they execute

2005-03-07 Thread jamesthiele . usenet
I have run into some cases where I would like to run a class method anytime any class method is invoked. That is, if I write x.foo then it will be the same as writing x.bar x.foo for any method in class x (with the possible exception of 'bar'). The first few times I wanted to print out a data st

Re: Catching all methods before they execute

2005-03-07 Thread Michael Hoffman
[EMAIL PROTECTED] wrote: I have run into some cases where I would like to run a class method anytime any class method is invoked. Perhaps you want __getattribute__ on a new-style class? -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.4 removes None data type?

2005-03-07 Thread Brian van den Broek
Steven Bethard said unto the world upon 2005-03-07 11:55: Warren Postma wrote: Michael Hoffman wrote: The fact that True and False are not constants? Yowza. a = True b = False False = a True = b if (1==2)==True: print "Doom" Why stop there when you can really cause some doom: py> import __bui

mod_python & "please recompile it with -DEAPI" apache warning

2005-03-07 Thread [EMAIL PROTECTED]
In regards to mod_python, I keep getting this warning when I do apachectl configtest: [warn] Loaded DSO libexec/mod_python.so uses plain Apache 1.3 API, this module might crash under EAPI! (please recompile it with -DEAPI) So I googled what I can, and have read various responses. Most say you

global variables

2005-03-07 Thread M.N.A.Smadi
hi; i have a project with multiple files in it. I need to have a varaible that will contain a value that will be modified in one file, and when coming back to the same file it should retain the same value. The way am doing it right now, python is complaining about the variable being non-glob

Re: Catching all methods before they execute

2005-03-07 Thread jamesthiele . usenet
>[EMAIL PROTECTED] wrote: >> I have run into some cases where I would like to run a class method >> anytime any class method is invoked. > >Perhaps you want __getattribute__ on a new-style class? >-- >Michael Hoffman Perhaps I do. The docs say that __getattribute__ is called on all attribute refer

zipimport IOError reading Modules.zip in Mac standalone app

2005-03-07 Thread Bob Swerdlow
We have some users of our application getting error messages like: IOError: zipimport: can not open file /Volumes/MyApp/MyApp.app/Contents/Resources/Modules.zip This only happens on our Mac version - the Windows version seems fine. Our build is still using bundlebuilder, which creates Modules

Re: survey

2005-03-07 Thread Dave Zhu
I'd like to know how scripts are processed, whether they are compiled into bytecode, how memory is allocated for variables, how scripting languages perform compared to each other, etc. --- Cameron Laird <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Peter Hansen <[EMAIL PROTECTED]

Unicode BOM marks

2005-03-07 Thread Francis Girard
Hi, For the first time in my programmer life, I have to take care of character encoding. I have a question about the BOM marks. If I understand well, into the UTF-8 unicode binary representation, some systems add at the beginning of the file a BOM mark (Windows?), some don't. (Linux?). Therefo

hidden attribute on Windows files

2005-03-07 Thread rbt
How do I enable the hidden attribute when creating files on Windows computers? I'd *really* prefer to do from the standard Python installer (no win32 extensions). Any tips? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Catching all methods before they execute

2005-03-07 Thread Michael Hoffman
[EMAIL PROTECTED] wrote: l = Undoable(list) l = [1, 2, 3] You just rebound l, so it no longer refers to an Undoable, it refers to a list. This design won't work, you need something more like: l = Undoable([1, 2, 3]) There were a few other pitfalls in your design... Here, try something like this ins

Re: shuffle the lines of a large file

2005-03-07 Thread François Pinard
[Joerg Schuster] > I am looking for a method to "shuffle" the lines of a large file. If speed and space are not a concern, I would be tempted to presume that this can be organised without too much difficulty. However, looking for speed handling a big file, while keeping equiprobability of all po

Re: shuffle the lines of a large file

2005-03-07 Thread François Pinard
[Heiko Wundram] > Replying to oneself is bad, [...] Not necessarily. :-) -- François Pinard http://pinard.progiciels-bpi.ca -- http://mail.python.org/mailman/listinfo/python-list

Re: python -i (interactive environment)

2005-03-07 Thread Steve Holden
Michael Hoffman wrote: Joe wrote: I want the script to decide whether to fall back to the interactive prompt. You solution makes it ALWAYS fall back to the interactive prompt. Actually, using sys.exit() means the program can exit even if python -i is used. You can use: import code code.interact()

Dr. Dobb's Python-URL! - weekly Python news and links (Mar 7)

2005-03-07 Thread Cameron Laird
QOTW: "Really, of course, the only things you need to make explicit are the ones that readers don't understand." -- Steve Holden "Working with unicode objects in Python is so transparent, it's easy to forget about what a C extension would likely want." -- Kevin Dangoor "You take leadership in a

Python 2.4 / WinXP / distutils error (cookbook example)

2005-03-07 Thread magoldfish
Hi, I've installed Python 2.4 on Windows XP and walked through the Alex Martelli ASPN cookbook example at: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66509 This is a recipe for a simple extension type for Python. When I try to build and install it, however, I get an error: c:\t

autoexecution in Windows

2005-03-07 Thread Earl Eiland
How does one make a Python program auto-execute in Windows? Earl -- http://mail.python.org/mailman/listinfo/python-list

Re: function with a state

2005-03-07 Thread Reinhold Birkenfeld
Reinhold Birkenfeld wrote: > or with a default function argument: > > > class Dummy: pass > > def myFun(globe=Dummy()): > try:globe.globe += 1 > except: globe.globe = 1 > > return globe.globe A quicker way: def myFun(globe=[0]): globe[0] += 1 return globe[0] Reinhold

Re: autoexecution in Windows

2005-03-07 Thread F. Petitjean
Le Mon, 07 Mar 2005 13:25:35 -0700, Earl Eiland a écrit : > How does one make a Python program auto-execute in Windows? > > Earl > write a virus ? :-) What do you mean by « auto-execute » ? Regards -- http://mail.python.org/mailman/listinfo/python-list

Re: hidden attribute on Windows files

2005-03-07 Thread Roel Schroeven
rbt wrote: > How do I enable the hidden attribute when creating files on Windows > computers? I'd *really* prefer to do from the standard Python installer > (no win32 extensions). Any tips? You could do os.system('attrib +h hidethis.txt') but that only works if hidethis already exists. -- "Cod

Re: autoexecution in Windows

2005-03-07 Thread Earl Eiland
In Linux, if I make the first line #!/path/to/Python, all I have to do to execute the program is type ./FileName (assuming my pwd is the same as FileName). what's the Windows equivalent? Earl On Mon, 2005-03-07 at 13:36, F. Petitjean wrote: > Le Mon, 07 Mar 2005 13:25:35 -0700, Earl Eiland a Ãcri

pyconfig.h

2005-03-07 Thread pythonnewbie
I have installed Python-2.3.3 in the SUSE Linux 9.1 system and am trying to rebuild an application rpm that was implemented in Python, the defines in the pyconfig.h seem to be related to Microsoft 32-bit and 64-bit environment, do I need these defines in the linux environment? what is the purpose o

Re: Unicode BOM marks

2005-03-07 Thread "Martin v. LÃwis"
Francis Girard wrote: If I understand well, into the UTF-8 unicode binary representation, some systems add at the beginning of the file a BOM mark (Windows?), some don't. (Linux?). Therefore, the exact same text encoded in the same UTF-8 will result in two different binary files, and of a slightl

Re: Python 2.4 / WinXP / distutils error (cookbook example)

2005-03-07 Thread "Martin v. Löwis"
[EMAIL PROTECTED] wrote: I have Visual Studio .NET Professional installed. Can anyone point me in the right direction? There are several solutions, but one is to install Visual Studio .NET 2003 (which is different from Visual Studio .NET, also referred to as VS.NET 2002). Microsoft managed to renam

Re: how to execute Python in VIM

2005-03-07 Thread DENG
thanks Aaron i've changed that, but this time, even worse... when i press F5, the pop-up windows appears, and then, it disppears very quickly...(less than 1 second) i cant see anything~ :( -- http://mail.python.org/mailman/listinfo/python-list

Re: autoexecution in Windows

2005-03-07 Thread rbt
Earl Eiland wrote: How does one make a Python program auto-execute in Windows? Earl No program (python or other) can just arbitrarily execute. A user has to click it or a cron-like utility (Task Scheduler) has to execute it at a set time. registry entries (such as run) can execute programs too. A

Re: hidden attribute on Windows files

2005-03-07 Thread "Martin v. Löwis"
rbt wrote: How do I enable the hidden attribute when creating files on Windows computers? I'd *really* prefer to do from the standard Python installer (no win32 extensions). Any tips? With pure Python and just the standard installer, you need to invoke attrib.exe, as attrib.exe +H Use os.system

  1   2   >