Re: py2exe error: 2.4.2.4: No such file or directory

2005-03-07 Thread Thomas Heller
Larry Bates <[EMAIL PROTECTED]> writes: > I had occasion to look back at a project I did over a year ago > and needed to make one small change. I use py2exe to package > it for distribution via Inno Setup. After making my change > I tried to run my setup script that worked fine before and > get

Re: Speeding up CGIHTTPServer

2005-03-07 Thread Tim Roberts
"Johan Kohler" <[EMAIL PROTECTED]> wrote: > >I'm using CGIHTTPServer (via its test() method) to test some CGI on my >Windoze 98 box. I find that the execution is very slow. Is there >anything I can do to make sure I'm getting the best performance out of >CGIHTTPServer? Compared to what, and on w

RE: Default function arguments, KURL::cleanPath() -- a bindings bug?

2005-03-07 Thread Delaney, Timothy C (Timothy)
Frans Englich wrote: > Apparently, cleanPath /requires/ a boolean argument, but the C++ > function definition says: > > void cleanPath(bool cleanDirSeparator = true); Most likely that cleanPath's default parameter hasn't been declared to *Python*. If so, I expect this is a KURL bug. Raise a bu

RE: parameter name conflict. How to solve?

2005-03-07 Thread Delaney, Timothy C (Timothy)
Steven Bethard wrote: >> If you ask: why do you choose these names? The answer is: they need >> to be conformable with other functions, parameter names. Is this a style guide thing? >> I have a function that pretty much like: >> >> def output(output=''): >> print output >> >> and now in anot

Default function arguments, KURL::cleanPath() -- a bindings bug?

2005-03-07 Thread Frans Englich
Hello, I've stumbled over a behavior related to default function arguments which appears to be a bug, from what I can tell. See this snippet: >>> from kdecore import KURL >>> u = KURL( "http://www.example.org/test/../"; ) >>> u.cleanPath() Traceback (most recent call last): File "", line 1,

unicode surrogates in py2.2/win

2005-03-07 Thread Mike Brown
In mid-October 2004, Jeff Epler helped me here with this string iterator: def chars(s): """ This generator function helps iterate over the characters in a string. When the string is unicode and a surrogate pair is encountered, the pair is returned together, regardless of whether

Re: parameter name conflict. How to solve?

2005-03-07 Thread Steven Bethard
Bo Peng wrote: Dear list, If you ask: why do you choose these names? The answer is: they need to be conformable with other functions, parameter names. I have a function that pretty much like: def output(output=''): print output and now in another function, I need to call output function, with a

Re: Mysterious "Attribute Errors" when GUI Programming

2005-03-07 Thread Robert Kern
Coral Snake wrote: I am having problems with programming even simple "Hello World" programs from books and tutorials that use Python GUI libraries. Such Programs cause python to throw "Attribute Errors" even when the "attributes" being asked for by the errors exist in the source code. This has happ

Re: Dictionaries of Lists

2005-03-07 Thread Steven Bethard
Tony Meyer wrote: [a for a in list] (or a[:]) makes a copy of a list. or list(a) STeVe -- http://mail.python.org/mailman/listinfo/python-list

Mysterious "Attribute Errors" when GUI Programming

2005-03-07 Thread Coral Snake
I am having problems with programming even simple "Hello World" programs from books and tutorials that use Python GUI libraries. Such Programs cause python to throw "Attribute Errors" even when the "attributes" being asked for by the errors exist in the source code. This has happened to me in both

parameter name conflict. How to solve?

2005-03-07 Thread Bo Peng
Dear list, If you ask: why do you choose these names? The answer is: they need to be conformable with other functions, parameter names. I have a function that pretty much like: def output(output=''): print output and now in another function, I need to call output function, with again keyword p

Re: Dictionaries of Lists

2005-03-07 Thread Terry Hancock
On Monday 07 March 2005 11:09 pm, gf gf wrote: > I'd like to associate certain lists with keywords, and > retrieve them. But this is not possible as lists are > not hashable. > > What is the best workaround? I don't mind making my > lists immutable. Is there a way to tupelize them? > I tried my

RE: Dictionaries of Lists

2005-03-07 Thread Tony Meyer
> I'd like to associate certain lists with keywords, and > retrieve them. But this is not possible as lists are > not hashable. A dictionary's values don't have to be hashable, so if the keywords are the keys in the dictionary, this would work. >>> d = {} >>> d['key1'] = [1,2,3] >>> d['key2'] =

Re: Dictionaries of Lists

2005-03-07 Thread Robert Kern
gf gf wrote: I'd like to associate certain lists with keywords, and retrieve them. But this is not possible as lists are not hashable. Do you want mydict[mylist] = mykey or mydict[mykey] = mylist ? The former is not possible with lists for the reason you noted. The latter, however, works just

Re: Dictionaries of Lists

2005-03-07 Thread Erik Max Francis
gf gf wrote: I'd like to associate certain lists with keywords, and retrieve them. But this is not possible as lists are not hashable. You can convert them to tuples with the `tuple' function: aDictionary[tuple(aList)] = aKeyword > What is the best workaround? I don't mind making my > lis

Dictionaries of Lists

2005-03-07 Thread gf gf
I'd like to associate certain lists with keywords, and retrieve them. But this is not possible as lists are not hashable. What is the best workaround? I don't mind making my lists immutable. Is there a way to tupelize them? I tried mydict[mykey]=([a for a in list]) but it didn't seem to work.

Queued stdout, flush() doesn't seems to help...

2005-03-07 Thread Dave Lajoie
Hello Everyone,   I have been using this piece of code to start an exec and "process" its stdout/stderror   import sysimport popen2 executable = r'execfile -arg1 -arg2'r, w, e = popen2.popen3(executable)r.flush()w.flush()e.flush() x=0 # just print the 1000 first lineswhile x<1000:    sys.std

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

2005-03-07 Thread magoldfish
Martin v. Löwis wrote: > 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 rename the C library (CRT) between > 2002 (msvcr7.dll) and 2003 (msvcr71.dll), and you need to

python-dev Summary for 2005-02-15 through 2005-02-28

2005-03-07 Thread Brett C.
[The HTML version of this Summary is available at http://www.python.org/dev/summary/2005-02-15_2005-02-28.html] = Summary Announcements = Status of the candidates It looks like all three candidates for taking

Re: Safe string escaping?

2005-03-07 Thread Bengt Richter
On Mon, 07 Mar 2005 19:24:43 -0500, "Grant Olson" <[EMAIL PROTECTED]> wrote: >I have a data file that has lines like "foo\n\0" where the \n\0 is acutally >backslash+n+backslash+0. I.E. a repr of the string from python would be >"foo\\n\\0". I'm trying to convert this string into one that contain

Re: select random entry from dictionary

2005-03-07 Thread Scott David Daniels
Tony Meyer wrote: How can I select a random entry from a dictionary, regardless of its key-values? a = random.choice(d.keys()) a, d[a] Or even: key, value = random.choice(d.items()) or: value = random.choice(d.values()) --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailm

Re: python -i (interactive environment)

2005-03-07 Thread Paulo Eduardo Neves
When I'm using pyunit and want to stop in a point during the test (skipping all the framework initialization), I just start the debugger: import pdb pdb.set_trace() You'll get the debugger prompt. -- http://mail.python.org/mailman/listinfo/python-list

Re: py2exe error: 2.4.2.4: No such file or directory

2005-03-07 Thread Stephen Thorne
On Mon, 07 Mar 2005 16:20:30 -0600, Larry Bates <[EMAIL PROTECTED]> wrote: > I had occasion to look back at a project I did over a year ago > and needed to make one small change. I use py2exe to package > it for distribution via Inno Setup. After making my change > I tried to run my setup script

Re: select random entry from dictionary

2005-03-07 Thread chengdu
import random print d[d.keys()[int(random.random()*len(d.keys()))]] HTH -c -- http://mail.python.org/mailman/listinfo/python-list

Re: select random entry from dictionary

2005-03-07 Thread [EMAIL PROTECTED]
>From the Python 2.4 quickreference: d.popitem() Removes and returns an arbitrary (key, value) pair from d If this isn't random enough, then you can generate a random number in range(len(d)) -- http://mail.python.org/mailman/listinfo/python-list

RE: select random entry from dictionary

2005-03-07 Thread Tony Meyer
> How can I select a random entry from a dictionary, regardless of its > key-values? >>> import random >>> d = {1:'a', 2:'b', 3:'c'} >>> a = random.choice(d.keys()) >>> a, d[a] (2, 'b') (etc) =Tony.Meyer -- http://mail.python.org/mailman/listinfo/python-list

select random entry from dictionary

2005-03-07 Thread Tor Erik Sønvisen
Hi How can I select a random entry from a dictionary, regardless of its key-values? regards tores -- http://mail.python.org/mailman/listinfo/python-list

Re: quick question

2005-03-07 Thread Steve Holden
Leeds, Mark wrote: I have a string variable say “8023 “ and I want to get rid of the beginning And ending quotes. I’ve tried different things But haven’t had any success. I’m definitely a python hacker and Not an expert. Thanks. >>> x = '"This is a quoted string"' >>> print x "This is a

Re: quick question

2005-03-07 Thread Daniel Bickett
If you simply wanted to get rid of quotes entirely, you could use: "\"Hello!\"".replace( "\"" , "" ) However, since you only want the beginning and ending quotes removed: >>> string = "\"If thou wert my fool, nuncle...\"" >>> print string "If thou wert my fool, nuncle..." >>> if string.startswi

Re: Safe string escaping?

2005-03-07 Thread Daniel Bickett
There is very likely a more reasonable solution than this, but it was the first one that came to mind: IDLE 1.0.3 >>> string = "foo\\n\\0" >>> string = string.replace( "\\n" , "\n" ) >>> string = string.replace( "\\0" , "\0" ) >>> string 'foo\n\x00' >>> print string foo Hope this helps. -

Re: Unicode BOM marks

2005-03-07 Thread "Martin v. LÃwis"
Francis Girard wrote: Well, no text files can't be concatenated ! Sooner or later, someone will use "cat" on the text files your application did generate. That will be a lot of fun for the new unicode aware "super-cat". Well, no. For example, Python source code is not typically concatenated, nor

Re: Safe string escaping?

2005-03-07 Thread Michael Hoffman
Grant Olson wrote: I have a data file that has lines like "foo\n\0" where the \n\0 is acutally backslash+n+backslash+0. I.E. a repr of the string from python would be "foo\\n\\0". I'm trying to convert this string into one that contains actual newlines and whatnot. r"foo\n\0".decode("string_escap

Safe string escaping?

2005-03-07 Thread Grant Olson
I have a data file that has lines like "foo\n\0" where the \n\0 is acutally backslash+n+backslash+0. I.E. a repr of the string from python would be "foo\\n\\0". I'm trying to convert this string into one that contains actual newlines and whatnot. I feel like there has to be a better and safer wa

Re: Exception handling code (try/except/finally)

2005-03-07 Thread Michael Hoffman
djw wrote: c.l.p- I am having trouble understanding how one is supposed to correctly utilize try:...except:...finally: in real code. If I have a block of code like: def foo(): try: ... some code that can raise an exception ... finally: ... do some cleanup ... retu

Exception handling code (try/except/finally)

2005-03-07 Thread djw
c.l.p- I am having trouble understanding how one is supposed to correctly utilize try:...except:...finally: in real code. If I have a block of code like: def foo(): try: ... some code that can raise an exception ... finally: ... do some cleanup ...

Re: IndexedCatalog and ZEO

2005-03-07 Thread Almad
Leif K-Brooks wrote: > from IndexedCatalog.Shelf import Shelf > shelf = Shelf(('localhost', 1234), [Class1, Class2]) Is it also possible to connect via socket instead of port? I've tried to pass '/tmp/zeosocket' instead of ('localhost', 1234), but it isn't successfull. Is is any way to do that?

quick question

2005-03-07 Thread Leeds, Mark
I have a string variable say “8023 “ and I want to get rid of the beginning And ending quotes.   I’ve tried different things But haven’t had any success.   I’m definitely a python hacker and Not an expert. Thanks.        Mark -- http://mail.

Re: pymem.h In function '__declspec'

2005-03-07 Thread Jeff Epler
What does this command print? gcc -c -I/usr/Python-2.3.3/Include -x c -o /dev/null \ /usr/Python-2.3.3/Include/pymem.h If it prints an error like the one you included in this message, then the set of header files in /usr/Python-2.3.3/Include is damaged, incomplete, or wrong for your com

pymen.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, I got the following error when compiling the application extension module, /usr/Python-2.3.3/Include/pymem.h: In function '__declspec' /usr/Python-2.3.3/Include/py

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

2005-03-07 Thread grahamd
[EMAIL PROTECTED] wrote: > 2) added to MakeFile after config: > EXTRA_CFLAGS=-DEAPI You can do this, but it should be to "src/Makefile" and added to "CFLAGS" and not "EXTRA_CFLAGS" as the latter doesn't exist. -- http://mail.python.org/mailman/listinfo/python-list

Re: global variables

2005-03-07 Thread Harlin Seritt
You most likely need to construct your script using OOP. Can give you give an example of code you're using when you get this error? This helps a lot. Regards, Harlin -- http://mail.python.org/mailman/listinfo/python-list

Re: mxDateTime on Mac: Fatal Python Error

2005-03-07 Thread Michael Maibaum
On Mon, Mar 07, 2005 at 11:51:20PM +0100, M.-A. Lemburg wrote: [EMAIL PROTECTED] wrote: 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

Re: Unicode BOM marks

2005-03-07 Thread Jeff Epler
On Mon, Mar 07, 2005 at 11:56:57PM +0100, Francis Girard wrote: > BTW, the python "unicode" built-in function documentation says it returns a > "unicode" string which scarcely means something. What is the python > "internal" unicode encoding ? The language reference says farily little about unic

Re: mxDateTime on Mac: Fatal Python Error

2005-03-07 Thread Dave Reed
On Monday 07 March 2005 17:51, M.-A. Lemburg wrote: > [EMAIL PROTECTED] wrote: > > 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

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

2005-03-07 Thread Scott David Daniels
Steven Reddie wrote: Hi, Thanks, that seems to be what I was missing. I'm having some further related trouble though. I want to do something like this: MODULES = [ 'module1', 'module2' ] def libinfo(): for m in MODULES: __import__('libinfo.'

pymem.h In function '__declspec'

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, I am getting the following error, /usr/Python-2.3.3/Include/pymem.h In function '__declspec' /usr/Python-2.3.3/Include/pymem.h:51: error: parse error before '__dec

Re: Unicode BOM marks

2005-03-07 Thread Francis Girard
Le lundi 7 Mars 2005 21:54, "Martin v. LÃwis" a ÃcritÂ: Hi, Thank you for your very informative answer. Some interspersed remarks follow. > > I personally would write my applications so that they put the signature > into files that cannot be concatenated meaningfully (since the > signature simp

Re: mxDateTime on Mac: Fatal Python Error

2005-03-07 Thread M.-A. Lemburg
[EMAIL PROTECTED] wrote: 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?) A

py2exe error: 2.4.2.4: No such file or directory

2005-03-07 Thread Larry Bates
I had occasion to look back at a project I did over a year ago and needed to make one small change. I use py2exe to package it for distribution via Inno Setup. After making my change I tried to run my setup script that worked fine before and get the following message: F:\SYSCON\WTS\HTMLmenu>pyth

Re: pyconfig.h

2005-03-07 Thread Jeff Epler
The pyconfig.h file (/usr/include/python2.3/pyconfig.h) should begin something like this /* pyconfig.h. Generated by configure. */ /* pyconfig.h.in. Generated from configure.in by autoheader. */ and shouldn't cause problems. If it starts in a wildly different way than that, then it's p

Re: programmatically calling a function

2005-03-07 Thread Larry Bates
I see lots of others have made suggestions, but here is a method that I use frequently: define a dictionary that contains references to your functions: def foo(): . . whatever it does . def bar(): . . whatever it does . xfer={'foo', foo, 'bar', bar} Then you can write for fname in fnames:

Re: shuffle the lines of a large file

2005-03-07 Thread Raymond Hettinger
[Joerg Schuster] > 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. Since the corpus is huge, the python portion s

Re: autoexecution in Windows

2005-03-07 Thread Bill
Earl Eiland wrote: > How does one make a Python program auto-execute in Windows? > > Earl You need to have files with .py or .pyo or .py registered to open with the python interpreter. In Windows Explorer, choose the menu item Tools->Folder Options and select the File Types tab to see how registe

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

2005-03-07 Thread Anthra Norell
> Heiko wrote:   > SETUP = object()> ELSE = object()> BREAK = object() > > machine = {"WAITING FOR ACTION":>   {customer_drops_coin:"COIN HAS BEEN DROPPED",>    customer_selects_beverage:"ORDER RECEIVED",>    customer_cancels_order:"ACCOUNT CLOSURE IS

Re: Python 2.4 removes None data type?

2005-03-07 Thread John Machin
[EMAIL PROTECTED] wrote: > Sheesh... I didn't actually pull the type(None) comparison out of my > code. Sheesh yourself. Newsgroup readers can't do inspect.hasaclue('J. Random Poster'); they rely on duck-typing or goose-typing. > I was simply throwing together a possible situation. Had I > thou

Re: zipimport IOError reading Modules.zip in Mac standalone app

2005-03-07 Thread Just
In article <[EMAIL PROTECTED]>, "Bob Swerdlow" <[EMAIL PROTECTED]> wrote: > 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 Window

Re: python -i (interactive environment)

2005-03-07 Thread Just
In article <[EMAIL PROTECTED]>, Steve Holden <[EMAIL PROTECTED]> wrote: > 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, usi

Re: win32com and Python2.4: Interpreter crashing!

2005-03-07 Thread Roger Upole
There's a bug in the tokenizer that's triggered by the long lines generated by makepy. See http://sourceforge.net/tracker/index.php?func=detail&aid=1085454&group_id=78018&atid=551954 and www.python.org/sf/1089395 Roger "Tim N. van der Leeuw" <[EMAIL PROTECTED]> wrote in message news:

Re: global variables

2005-03-07 Thread David S.
M.N.A.Smadi grads.ece.mcmaster.ca> writes: > 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. You must import the module in which the variable lives and qualify it appropriately.

Re: i18n: looking for expertise

2005-03-07 Thread klappnase
"Serge Orlov" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > I've never used tkinter, but I heard good things about it. Are you > sure it's not you who made it to return byte string sometimes? Yes, I used a Tkinter.StringVar to keep track of the contents of an Entry widget; a

Re: hidden attribute on Windows files

2005-03-07 Thread John Machin
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? > > Thanks Breaking your problem down a bit: 1. How is that done from the command line in Windows? 2. How t

Re: autoexecution in Windows

2005-03-07 Thread Earl Eiland
O.K. I stand corrected. "auto-execute is the wrong term. Earl On Mon, 2005-03-07 at 14:03, rbt wrote: > 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

Re: autoexecution in Windows

2005-03-07 Thread "Martin v. Löwis"
Earl Eiland wrote: How does one make a Python program auto-execute in Windows? Use any of the mechanisms to make an arbitrary program auto-execute (do you want on boot, on login, or what?), and use c:\pythonXY\python.exe as the executable name; use the script name as the first argument. Regards, Ma

Re: autoexecution in Windows

2005-03-07 Thread rbt
Earl Eiland wrote: 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, Ea

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

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: 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: 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: 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

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: 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

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 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: 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

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

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

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

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()

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: 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: 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

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

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

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]

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: 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

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

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

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

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

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: 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

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: 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: 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 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: 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: 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: 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: 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

  1   2   >