py2exe Python2.4 and "warning: string/unicode conversion"

2005-03-08 Thread Miki Tebeka
Hello All, I'm shipping an application using py2exe. With Python2.3 it worked fine but when switching to Python2.4 I started getting "warning: string/unicode conversion" all over the place. Any ideas how to solve this (other than using 'filterwarnings')? Thanks. Bye. --

Re: unicode surrogates in py2.2/win

2005-03-08 Thread "Martin v. LÃwis"
Mike Brown wrote: Very strange how it only shows up after the 1st import attempt seems to succeed, and it doesn't ever show up if I run the code directly or run the code in the command-line interpreter. The reason for that is that the Python byte code stores the Unicode literal in UTF-8. The firs

Re: i18n: looking for expertise

2005-03-08 Thread "Martin v. Löwis"
klappnase wrote: I am using python-2.3.4 and get unicode errors: f = os.path.join(u'/home/pingu/phonoripper', u'\xc3\u20ac') os.path.isfile(f) True os.access(f, os.R_OK) Traceback (most recent call last): File "", line 1, in ? UnicodeEncodeError: 'ascii' codec can't encode characters in position

Re: Unicode BOM marks

2005-03-08 Thread Francis Girard
Hi, > Well, no. For example, Python source code is not typically concatenated, > nor is source code in any other language. We did it with C++ files in order to have only one compilation unit to accelarate compilation time over network. Also, all the languages with some "include" directive will

Re: Unicode BOM marks

2005-03-08 Thread Francis Girard
Hi, Thank you for your answer. That confirms what Martin v. LÃwis says. You can choose between UCS-2 or UCS-4 for internal unicode representation. Francis Girard Le mardi 8 Mars 2005 00:44, Jeff Epler a ÃcritÂ: > On Mon, Mar 07, 2005 at 11:56:57PM +0100, Francis Girard wrote: > > BTW, the pytho

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

2005-03-08 Thread Frans Englich
Ups, that was meant to go to the pykde list. Sorry, Frans -- http://mail.python.org/mailman/listinfo/python-list

Re: parameter name conflict. How to solve?

2005-03-08 Thread Daniel Dittmar
Bo Peng wrote: def func(output=''): output(output=output) Naturally, I get 'str' object is not callable. Is there a way to tell func that the first output is actually a function? (like in C++, ::output(output) ) output_alias = output def func (output=''): output_alias(output=output) Daniel

Best way to make a list unique?

2005-03-08 Thread Eric Pederson
I have >>> listA=[1,2,3,4,5,4,3,4,3,2,1] and I want a list of only the unique members. This seems inefficient, but works fine over my small sample lists: >>> listA=[a for a in set(listA)] Is there a more efficient approach for cases where listA is large? Eric Pederson :

Re: How to script DOS app that doesn't use stdout

2005-03-08 Thread Gregor
> "Gregor" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >> There's a DOS console application I am trying to script (in Python), >> but it >> doesn't seem to use stdout or stderr... For example, if I redirect >> output to a file ("cmd > file.txt"), the output still appears on >>

Re: py2exe Python2.4 and "warning: string/unicode conversion"

2005-03-08 Thread "Martin v. Löwis"
Miki Tebeka wrote: > I'm shipping an application using py2exe. With Python2.3 it worked fine but when switching to Python2.4 I started getting "warning: string/unicode conversion" all over the place. Any ideas how to solve this (other than using 'filterwarnings')? It is really surprising that you

Re: Best way to make a list unique?

2005-03-08 Thread Diez B. Roggisch
Eric Pederson wrote: > I have > listA=[1,2,3,4,5,4,3,4,3,2,1] > > and I want a list of only the unique members. > > This seems inefficient, but works fine over my small sample lists: > listA=[a for a in set(listA)] > > > Is there a more efficient approach for cases where listA is l

Re: Creating module skeleton from unit tests

2005-03-08 Thread Edvard Majakari
Peter Maas <[EMAIL PROTECTED]> writes: > I think this is too difficult, because there are many ways to write > code (even skeletons) for a use case. An easier approach would > be to write the skeleton manually, embed the test cases in the doc > strings and generate the test code from the doc strin

Re: parameter name conflict. How to solve?

2005-03-08 Thread Kent Johnson
Bo Peng wrote: def func(output=''): output(output=output) Naturally, I get 'str' object is not callable. Is there a way to tell func that the first output is actually a function? (like in C++, ::output(output) ) You could use a default argument: def func(output='', output_fn=output): output_f

Re: Creating module skeleton from unit tests

2005-03-08 Thread Edvard Majakari
Fabio Zadrozny <[EMAIL PROTECTED]> writes: > I think that the best approach I saw to this was in the Eclipse java > ide... You can basically go on the declaration of > > self.obj = player.Player('Fred the Adventurer') > > press Ctrl+1 and it adds a suggestion to create the class Player. > > Then g

Re: shuffle the lines of a large file

2005-03-08 Thread Nick Craig-Wood
Raymond Hettinger <[EMAIL PROTECTED]> wrote: > >>> from random import random > >>> out = open('corpus.decorated', 'w') > >>> for line in open('corpus.uniq'): > print >> out, '%.14f %s' % (random(), line), > > >>> out.close() > > sort corpus.decorated | cut -c 18- > corpus.randomized Ve

looking for way to include many times some .py code from another python code

2005-03-08 Thread Martin MOKREJŠ
Hi, I'm looking for some easy way to do something like include in c or PHP. Imagine I would like to have: cat somefile.py a = 222 b = 111 c = 9 cat somefile2.py self.xxx = a self.zzz = b self.c = c self.d = d cat anotherfile.py def a(): include somefile postprocess(a) def b(): include som

Re: Speeding up CGIHTTPServer (Tim Roberts)

2005-03-08 Thread Johan Kohler
On Tue, 8 Mar 2005 10:25:46 +0100 (CET), <[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? Co

Re: Google Technology

2005-03-08 Thread vijay123
Thank you all! It's a good start for me...with the info. u provided. -- http://mail.python.org/mailman/listinfo/python-list

Re: Speeding up CGIHTTPServer (Tim Roberts)

2005-03-08 Thread Diez B. Roggisch
> If there is no way to improve performance, could anyone tell my _why_ it's > running so slowly? Presumably spawning a process takes some time. The > code I'm running as CGI is not hectic at all. Just an educated guess: Maybe some timeouts or slowly answered requests are the problem - e.g. DNS

Re: Best way to make a list unique?

2005-03-08 Thread Max M
Eric Pederson wrote: I have listA=[1,2,3,4,5,4,3,4,3,2,1] and I want a list of only the unique members. This seems inefficient, but works fine over my small sample lists: listA=[a for a in set(listA)] Is there a more efficient approach for cases where listA is large? no. Even though the code

Re: Speeding up CGIHTTPServer

2005-03-08 Thread Steve Holden
Tim Roberts wrote: "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 w

Re: Mysterious "Attribute Errors" when GUI Programming

2005-03-08 Thread Steve Holden
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: Speeding up CGIHTTPServer (Tim Roberts)

2005-03-08 Thread Thomas Guettler
Am Tue, 08 Mar 2005 13:56:57 +0200 schrieb Johan Kohler: > On Tue, 8 Mar 2005 10:25:46 +0100 (CET), <[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 d

Good variable names (Was: Re: Best way to make a list unique?)

2005-03-08 Thread Roy Smith
"Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > inserted = set() > res = [] > for e in listA: >if not e in inserted: >res.append(e) >inserted.add(e) > listA = res I'm going to go off on a tangent here and put in a plea for better variable naming. I'm looking at the above code

Re: looking for way to include many times some .py code from another python code

2005-03-08 Thread Brano Zarnovican
On Tuesday 08 March 2005 12:41, Martin MOKREJŠ wrote: > cat somefile.py > a = 222 > b = 111 > c = 9 > > cat anotherfile.py > > def a(): > include somefile > postprocess(a) What about : def a(): exec open('somefile.py') postprocess(a) You can even use the optional dictionary parameter:

Re: looking for way to include many times some .py code from anotherpython code

2005-03-08 Thread Scott David Daniels
Martin MOKREJŠ wrote: Hi, I'm looking for some easy way to do something like include in c or PHP. Imagine I would like to have: I know about module imports and reloads, but am not sure if this is the right way to go. Mainly, I want to assign to multiple object instances some self bound v

[Fwd: Re: quick question]

2005-03-08 Thread Neil Benn
-- Neil Benn Senior Automation Engineer Cenix BioScience BioInnovations Zentrum Tatzberg 46 D-01307 Dresden Germany Tel : +49 (0)351 4173 154 e-mail : [EMAIL PROTECTED] Cenix Website : http://www.cenix-bioscience.com --- Begin Message --- Leeds, Mark wrote: I have a string variable say “8023 “ and

RE: Best way to make a list unique?

2005-03-08 Thread Batista, Facundo
Title: RE: Best way to make a list unique? [Max M] #-  >>> la = [1,2,3,4,3,2,3,4,5] #-  >>> from sets import Set #-  >>> sa = Set(la) #-  >>> for itm in sa: #- ... print itm Remember that in Python 2.4 you have ´´set´´ as a built-in data type: >>> la = [1,2,3,4,3,2,3,4,5] >>> sa = se

Re: Good variable names (Was: Re: Best way to make a list unique?)

2005-03-08 Thread Diez B. Roggisch
> I'm going to go off on a tangent here and put in a plea for better > variable > naming. I'm looking at the above code, and can't figure out what "res" is > supposed to be. Is it short for "rest", as in "the rest of the items"? > Residual? Result? Restore? Any of these seems plausable. Not k

Re: Best way to make a list unique?

2005-03-08 Thread Scott David Daniels
Max M wrote: Eric Pederson wrote: listA = list(Set(listA)) As of 2.4, set is a built-in type (2.3 had Set in module sets). Another 2.4-ism is "sorted", which might very well be the way you want to turn the set into a list: listA = sorted(set(listA)) for this particular use, you can define sorte

Re: looking for way to include many times some .py code from anotherpython code

2005-03-08 Thread Kent Johnson
Martin MOKREJŠ wrote: Hi, I'm looking for some easy way to do something like include in c or PHP. Imagine I would like to have: cat somefile.py a = 222 b = 111 c = 9 cat somefile2.py self.xxx = a self.zzz = b self.c = c self.d = d cat anotherfile.py def a(): include somefile postprocess(a) d

Re: looking for way to include many times some .py code from anotherpython code

2005-03-08 Thread Martin MOKREJŠ
Scott David Daniels wrote: Martin MOKREJŠ wrote: Hi, I'm looking for some easy way to do something like include in c or PHP. Imagine I would like to have: I know about module imports and reloads, but am not sure if this is the right way to go. Mainly, I want to assign to multiple object

Re: looking for way to include many times some .py code from anotherpython code

2005-03-08 Thread Diez B. Roggisch
> See my post on Mar 2 about "automating assignment of class variables". > I got no answers, maybe I wasn't clear enough ... :( Seems so - I for example didn't understand it. > > I need to define lots of variables. The variable names are often > identical. The problem is that if I put such a cod

Re: looking for way to include many times some .py code from anotherpython code

2005-03-08 Thread Martin MOKREJŠ
Kent Johnson wrote: Martin MOKREJŠ wrote: Hi, I'm looking for some easy way to do something like include in c or PHP. Imagine I would like to have: cat somefile.py a = 222 b = 111 c = 9 cat somefile2.py self.xxx = a self.zzz = b self.c = c self.d = d cat anotherfile.py def a(): include somefile

Sorting dictionary by 'sub' value

2005-03-08 Thread Rory Campbell-Lange
I have a dictionary of images. I wish to sort the dictionary 'v' by a dictionary value using python 2.3. The dictionary value is the date attribute as shown here: v[imagename][9]['date'] This attribute is an extracted EXIF value from the following set: data element [9] of v[imagename]:

determine directories with wildcard

2005-03-08 Thread Thomas Rademacher
Hello, I want to collect with the wildcard '*' all existing directories. For example: /dir/dir/*/dir/*/dir/* or C:\dir\dir\*\dir\*\dir\* How can I resolve this problem? Thanks for your hints, Thomas. -- http://mail.python.org/mailman/listinfo/python-list

Re: looking for way to include many times some .py code from anotherpython code

2005-03-08 Thread Martin MOKREJŠ
Diez B. Roggisch wrote: See my post on Mar 2 about "automating assignment of class variables". I got no answers, maybe I wasn't clear enough ... :( Seems so - I for example didn't understand it. I need to define lots of variables. The variable names are often identical. The problem is that if I p

Re: Accessing files installed with distutils

2005-03-08 Thread [EMAIL PROTECTED]
I was wondering how to do this too. I'm trying to write a distutils setup.py script that has some data I'd like to include. From the distutils docs I get data_files specifies a sequence of (directory, files) pairs in the following way: setup(... data_files=[('bitmaps', ['bm/b1.gif', 'bm/b2

Re: Appeal for python developers

2005-03-08 Thread huw . davies
BOOGIEMAN <[EMAIL PROTECTED]> 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 It was only when I read this thread t

Re: Sorting dictionary by 'sub' value

2005-03-08 Thread Diez B. Roggisch
> I have a dictionary of images. I wish to sort the dictionary 'v' by a > dictionary value using python 2.3. The dictionary value is the date > attribute as shown here: > > v[imagename][9]['date'] > > This attribute is an extracted EXIF value from the following set: > > data element [9]

Re: parameter name conflict. How to solve?

2005-03-08 Thread Pierre Barbier de Reuille
Bo Peng a écrit : 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, wit

Re: determine directories with wildcard

2005-03-08 Thread Diez B. Roggisch
Thomas Rademacher wrote: > Hello, > > I want to collect with the wildcard '*' all existing directories. > For example: /dir/dir/*/dir/*/dir/* or C:\dir\dir\*\dir\*\dir\* > > How can I resolve this problem? This is some sort of pattern matching. What I'd do is to convert your pattern to a regex

Re: determine directories with wildcard

2005-03-08 Thread Heiko Wundram
On Tuesday 08 March 2005 14:33, Thomas Rademacher wrote: > How can I resolve this problem? python >>> import glob >>> help(glob) or look at the online documentation for glob. -- --- Heiko. pgp6MyvJSQxu3.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Split text file into words

2005-03-08 Thread qwweeeit
The standard split() can use only one delimiter. To split a text file into words you need multiple delimiters like blank, punctuation, math signs (+-*/), parenteses and so on. I didn't succeeded in using re.split()... -- http://mail.python.org/mailman/listinfo/python-list

Re: determine directories with wildcard

2005-03-08 Thread Vincent Wehren
Thomas Rademacher wrote: Hello, I want to collect with the wildcard '*' all existing directories. For example: /dir/dir/*/dir/*/dir/* or C:\dir\dir\*\dir\*\dir\* How can I resolve this problem? Thanks for your hints, Thomas. You may want to check out the glob module. E.g. something like: >> impor

Out of Office AutoReply: MDaemon Warning - virus found: Returned mail: Data format error

2005-03-08 Thread Jover, Sergi (BPDO VAT Reporting)
Hi, I will be on vacation from Monday 7th till Friday 11th both included. And during this time I will not be able to access to my phone and email. For urgent queries please contact: * HPIS USZ8 and HP UK ltd please contact Nuria Satorra, * All other VAT reporting operation queries please con

Re: Split text file into words

2005-03-08 Thread Heiko Wundram
On Tuesday 08 March 2005 14:43, qwweeeit wrote: > The standard split() can use only one delimiter. To split a text file > into words you need multiple delimiters like blank, punctuation, math > signs (+-*/), parenteses and so on. > > I didn't succeeded in using re.split()... Then try again... ;)

Re: determine directories with wildcard

2005-03-08 Thread Simon Brunning
On Tue, 8 Mar 2005 14:33:59 +0100, Thomas Rademacher <[EMAIL PROTECTED]> wrote: > Hello, > > I want to collect with the wildcard '*' all existing directories. > For example: /dir/dir/*/dir/*/dir/* or C:\dir\dir\*\dir\*\dir\* How about something like: import fnmatch import os root = 'd:\\' filt

Re: Accessing files installed with distutils

2005-03-08 Thread Steve Holden
[EMAIL PROTECTED] wrote: I was wondering how to do this too. I'm trying to write a distutils setup.py script that has some data I'd like to include. From the distutils docs I get data_files specifies a sequence of (directory, files) pairs in the following way: setup(... data_files=[('bitmaps

Re: Speeding up CGIHTTPServer (Tim Roberts)

2005-03-08 Thread Steve Nordby
"Diez B. Roggisch" wrote: > > If there is no way to improve performance, could anyone tell my _why_ it's > > running so slowly? Presumably spawning a process takes some time. The > > code I'm running as CGI is not hectic at all. > > Just an educated guess: Maybe some timeouts or slowly answered

Re: looking for way to include many times some .py code fromanotherpython code

2005-03-08 Thread Kent Johnson
Martin MOKREJŠ wrote: Oh, I've picked up not the best example. I wanted to set the variables not under __init__, but under some other method. So this is actually what I really wanted. class klass(somefile2.base): def __init__(): pass def set_them(self, a, b, c, d): somefile2.base.__

Re: looking for way to include many times some .py code from anotherpython code

2005-03-08 Thread Duncan Booth
Martin MOKREJŠ wrote: > Am I so deperately fighting the language? No-one here on the list > needs to set hundreds variables at once somewhere in their code? I > still don't get why: I've certainly never needed to set hundreds of variables at once in my code. I might have hundreds of values, but

Re: determine directories with wildcard

2005-03-08 Thread Thomas Rademacher
Thanks. It works fine! Thomas "Vincent Wehren" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > Thomas Rademacher wrote: > > Hello, > > > > I want to collect with the wildcard '*' all existing directories. > > For example: /dir/dir/*/dir/*/dir/* or C:\dir\dir\*\dir\*\dir\* > > >

RE: Sorting dictionary by 'sub' value

2005-03-08 Thread Batista, Facundo
Title: RE: Sorting dictionary by 'sub' value [Rory Campbell-Lange] #- I have a dictionary of images. I wish to sort the dictionary 'v' by a #- dictionary value using python 2.3. The dictionary value is the date #- attribute as shown here: You have to use the DSU algorithm (Decorate, Sort,

Re: Split text file into words

2005-03-08 Thread Duncan Booth
qwweeeit wrote: > The standard split() can use only one delimiter. To split a text file > into words you need multiple delimiters like blank, punctuation, math > signs (+-*/), parenteses and so on. > > I didn't succeeded in using re.split()... > Would you care to elaborate on how you tried to

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

2005-03-08 Thread Larry Bates
Thomas, Right on the mark. Thanks for the help. Larry Bates Thomas Heller wrote: > 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

capturing text from a GUI window

2005-03-08 Thread Earl Eiland
Anyone know how to capture text from GUI output? I need to process information returned via a GUI window. Earl -- http://mail.python.org/mailman/listinfo/python-list

Re: shuffle the lines of a large file

2005-03-08 Thread Simon Brunning
On 7 Mar 2005 06:38:49 -0800, gry@ll.mit.edu wrote: > As far as I can tell, what you ultimately want is to be able to extract > a random ("representative?") subset of sentences. If this is what's wanted, then perhaps some variation on this cookbook recipe might do the trick: http://aspn.activest

Re: looking for way to include many times some .py code from anotherpython code

2005-03-08 Thread Steve Holden
Martin MOKREJŠ wrote: Diez B. Roggisch wrote: See my post on Mar 2 about "automating assignment of class variables". I got no answers, maybe I wasn't clear enough ... :( Seems so - I for example didn't understand it. I need to define lots of variables. The variable names are often identical. The

Re: looking for way to include many times some .py code fromanotherpython code

2005-03-08 Thread Scott David Daniels
Martin MOKREJŠ wrote: If I put them into a module, it get's executed only once unless I > do reload. And I'd have to use: "from some import *", because mainly I'm interrested in assigning to self: self.x = "blah" self.y = "uhm" OK, somewhere in here I think I get what you want to do. Essent

Re: shuffle the lines of a large file

2005-03-08 Thread Simon Brunning
On Tue, 8 Mar 2005 14:13:01 +, Simon Brunning <[EMAIL PROTECTED]> wrote: > On 7 Mar 2005 06:38:49 -0800, gry@ll.mit.edu wrote: > > As far as I can tell, what you ultimately want is to be able to extract > > a random ("representative?") subset of sentences. > > If this is what's wanted, then p

Small but significant memory leak in Pyana XSLT processor

2005-03-08 Thread Ola Natvig
Hi all I'm working with a long running, threaded server which serves HTTP requests with content which are passed through a XSLT processor. The XSLT processor I'm using is the Pyana processor. I have one compiled stylesheet which I uses to process all responses. This way I only need to read and

Re: Sorting dictionary by 'sub' value

2005-03-08 Thread Scott David Daniels
Diez B. Roggisch wrote: I have a dictionary of images. I wish to sort the dictionary 'v' by a dictionary value using python 2.3. The dictionary value is the date attribute as shown here: v[imagename][9]['date'] ... You can't sort dicts - they don't impose an order on either key or value. There a

Recognizing the Arrival of a New File

2005-03-08 Thread Greg Lindstrom
Hello- I am writing an application where I need to recognize when a file arrives in a given directory. Files may arrive at any time during the course of the day. Do I set up a cron job to poll the directory every few minutes? Write a daemon to monitor the directory? Or is there some other m

Re: shuffle the lines of a large file

2005-03-08 Thread Heiko Wundram
On Tuesday 08 March 2005 15:28, Simon Brunning wrote: > This has the advantage that every line had the same chance of being > picked regardless of its length. There is the chance that it'll pick > the same line more than once, though. Problem being: if the file the OP is talking about really is 80

Re: Small but significant memory leak in Pyana XSLT processor

2005-03-08 Thread Brian Quinlan
Ola Natvig wrote: My problem: When serving my content without the XSLT processor the process size remains the same size. (about 18MB in the windows task manager). But when I use the XSLT processor the process will slowly gain size. About 1MB for each 10k requests, and this memory are not freed.

Re: shuffle the lines of a large file

2005-03-08 Thread Simon Brunning
On Tue, 8 Mar 2005 15:49:35 +0100, Heiko Wundram <[EMAIL PROTECTED]> wrote: > Problem being: if the file the OP is talking about really is 80GB in size, and > you consider a sentence to have 80 bytes on average (it's likely to have less > than that), that makes 10^9 sentences in the file. Now, mult

Re: quick question

2005-03-08 Thread Simon Brunning
On Mon, 7 Mar 2005 18:58:20 -0500, Leeds, Mark <[EMAIL PROTECTED]> wrote: > > I have a string variable say "8023 " and > > I want to get rid of the beginning > > And ending quotes. Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "cre

Re: python -i (interactive environment)

2005-03-08 Thread Joe
Found that out :-( You can use the local=locals() option so at least you have access to the local variables, which in the case of debugging, is exactly what I needed. Since -i gives you control at the end of the program the locals are already gone. Seems like both approaches have their advanta

Re: python -i (interactive environment)

2005-03-08 Thread Joe
Right, but only one namespace. Would be nice if there was a way to give it both the global and the local namespaces. In my case though the local namespace was sufficient. "Just" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > code.interact() has a namespace argument ('local'), s

RE: Recognizing the Arrival of a New File

2005-03-08 Thread Batista, Facundo
Title: RE: Recognizing the Arrival of a New File [Greg Lindstrom] #- I am writing an application where I need to recognize when a file #- arrives in a given directory.  Files may arrive at any time #- during the #- course of the day.  Do I set up a cron job to poll the #- directory every

Re: autoexecution in Windows

2005-03-08 Thread Peter Hansen
Bill wrote: I can double click on a .py file and it executes, or use the command prompt. I believe if you install the Activestate distribution it sets up the file registrations automatically. As does the standard Windows distribution from python.org. -Peter -- http://mail.python.org/mailman/listinf

Re: Recognizing the Arrival of a New File

2005-03-08 Thread TZOTZIOY
On Tue, 08 Mar 2005 08:43:04 -0600, rumours say that Greg Lindstrom <[EMAIL PROTECTED]> might have written: >I am writing an application where I need to recognize when a file >arrives in a given directory. Files may arrive at any time during the >course of the day. Do I set up a cron job to po

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

2005-03-08 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: select random entry from dictionary

2005-03-08 Thread Peter Hansen
[EMAIL PROTECTED] wrote: 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)) Although this idea may suit the OP, "arbitrary" is most definitely not "ran

Re: parameter name conflict. How to solve?

2005-03-08 Thread Bo Peng
Delaney, Timothy C (Timothy) wrote: Is this a style guide thing? Why not just: def func(output_param=''): output(output=output_param) This is exactly the problem. There are a bunch of other functions that use output='' parameter. Changing parameter name for this single function may cause conf

Re: looking for way to include many times some .py code from anotherpython code

2005-03-08 Thread Martin MOKREJŠ
Hi to everyone who has repsonded. I'll try to clarify my problem in more detail. I believe I have the answers how to assign to self. in superclasses. In case you would know of yet another way, let me know. ;) Steve Holden wrote: Martin MOKREJŠ wrote: Diez B. Roggisch wrote: See my post on Mar 2 abo

Re: parameter name conflict. How to solve?

2005-03-08 Thread Bo Peng
Kent Johnson wrote: Bo Peng wrote: def func(output=''): output(output=output) Naturally, I get 'str' object is not callable. Is there a way to tell func that the first output is actually a function? (like in C++, ::output(output) ) You could use a default argument: def func(output='', output_f

Re: looking for way to include many times some .py code from anotherpython code

2005-03-08 Thread Steven Bethard
Martin MOKREJŠ wrote: The data passed to an instance come from sql tables. I have the idea every table will be represented by an object. Have you looked at SQLObject? I've never used it, but it does seem like this is the sort of thing it was designed for: http://sqlobject.org/ STeVe -- http://ma

Re: parameter name conflict. How to solve?

2005-03-08 Thread Duncan Booth
Bo Peng wrote: > Thank everyone for the quick responses. All methods work in general. > Since func() has to take the same parameter set as some other functins, > I can not use func(output='', output_fn=output). "output_alias=output" > etc are fine. One suggestion that I haven't seen so far:

Re: Accessing files installed with distutils

2005-03-08 Thread Thomas Heller
Steve Holden <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] wrote: >> I was wondering how to do this too. I'm trying to write a distutils >> setup.py script that has some data I'd like to include. From the >> distutils docs I get >> data_files specifies a sequence of (directory, files) pairs in

Re: Unicode BOM marks

2005-03-08 Thread John Roth
""Martin v. LÃwis"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] 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-ca

Re: looking for way to include many times some .py code from anotherpython code

2005-03-08 Thread Peter Hansen
Martin MOKREJŠ wrote: Am I so deperately fighting the language? No-one here on the list needs to set hundreds variables at once somewhere in their code? Nobody needs to do that. As others have pointed out, creating variables implies wanting to access them distinctly, not as a whole group. If yo

Re: looking for way to include many times some .py code from anotherpython code

2005-03-08 Thread Martin MOKREJŠ
Peter Hansen wrote: Martin MOKREJŠ wrote: Am I so deperately fighting the language? No-one here on the list needs to set hundreds variables at once somewhere in their code? Nobody needs to do that. As others have pointed out, creating variables implies wanting to access them distinctly, not as

Re: capturing text from a GUI window

2005-03-08 Thread Peter Hansen
Earl Eiland wrote: Anyone know how to capture text from GUI output? I need to process information returned via a GUI window. It might help (at least in terms of justifying this as an on-topic post) to describe in what way this is a Python question. Is it a Python program that produces the output?

Re: quick question

2005-03-08 Thread Peter Hansen
Simon Brunning wrote: On Mon, 7 Mar 2005 18:58:20 -0500, Leeds, Mark <[EMAIL PROTECTED]> wrote: I want to get rid of the beginning And ending quotes. my_string = '"8023 "' my_string.strip('"') '8023 ' Note the risk in this approach, as it blindly removes any number of leading and trailin

Re: Speeding up CGIHTTPServer (Tim Roberts)

2005-03-08 Thread elbertlev
Starting a process on WIN98 is VERY slow. (On NT much faster the second time). If you really want to use WIN98, modify CGIHTTPServer.py in such a way, that branch #Other O.S. -- execute script in this process is executed. This way CGIHTTPServer is as fast as it gets. At least not slower then ISA

cgi.py bug

2005-03-08 Thread Joe
While debugging a problem I was having I found a bug in the cgi.py module. When the environment does not have a correctly set REQUEST_METHOD cgi.py prompts for key=value pairs by reading from sys.stdin. After the values are read from sys.stdin they are never stored in the FieldStorage.list attr

Re: python -i (interactive environment)

2005-03-08 Thread Joe
Isn't this a bug? Here's the test program: import code def test_func(): lv = 1 print '\n\nBEFORE lv: %s\n' % (lv) code.interact(local=locals()) print '\n\nAFTER lv: %s\n' % (lv) return test_func() gv = 1 print '\n\nBEFORE gv: %s\n' % (gv) code.interact(local=locals()) prin

Python 2.4 OSX Package

2005-03-08 Thread Daniel Alexandre
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi there, I've just finished creating a package for Python 2.4 for users who don't want to install it from sources under Mac OS X Panther. The same has been tested and it's working perfectly for me. The package is available in the .pkg format and it'

Re: python -i (interactive environment)

2005-03-08 Thread Steven Bethard
Joe wrote: Isn't this a bug? Here's the test program: import code def test_func(): lv = 1 print '\n\nBEFORE lv: %s\n' % (lv) code.interact(local=locals()) print '\n\nAFTER lv: %s\n' % (lv) return Check the documentation for locals() [1]: "Update and return a dictionary represen

Format strings that contain '%'

2005-03-08 Thread [EMAIL PROTECTED]
I'm trying to do something along the lines of >>> print '%temp %d' % 1 Traceback (most recent call last): File "", line 1, in ? ValueError: unsupported format character 't' (0x74) at index 1 although, obviously I can't do this, since python thinks that the '%t' is a format string. I've tried o

Re: Format strings that contain '%'

2005-03-08 Thread Erik Max Francis
[EMAIL PROTECTED] wrote: I'm trying to do something along the lines of print '%temp %d' % 1 Traceback (most recent call last): File "", line 1, in ? ValueError: unsupported format character 't' (0x74) at index 1 Use %%: >>> '%%temp %d' % 1 '%temp 1' -- Erik Max Francis && [EMAIL PROTECTED] && htt

Re: python -i (interactive environment)

2005-03-08 Thread Joe
Steve, Thanks, I knew about that but my question is why is it not working consistently? Joe "Steven Bethard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Joe wrote: >> Isn't this a bug? >> >> Here's the test program: >> >> import code >> >> def test_func(): >> lv = 1 >>

Re: Format strings that contain '%'

2005-03-08 Thread Diez B. Roggisch
> Will anything else work here? Use %% print "%%s %s" % "foo" -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

distutils: binary distribution?

2005-03-08 Thread Stefan Waizmann
Hello, I would like the distutils are creating a binary distribution only - means create the distribution file with *.pyc files WITHOUT the *.py files. Any ideas? Or are the distutils the wrong tool for that? "setup.py bdist" creates binary dist, but includes the sourcecode cheers Stefan -- "Wa

Re: Format strings that contain '%'

2005-03-08 Thread [EMAIL PROTECTED]
Thanks!! -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorting dictionary by 'sub' value

2005-03-08 Thread Rory Campbell-Lange
Thank you all very much for your help. I did the following and it works: imgs=v.keys() imgs.sort(lambda a,b: cmp( time.strptime(str(v[a][9]['date']), '%Y:%m:%d %H:%M:%S'), time.strptime(str(v[b][9]['date']), '%Y:%m:%d %H:%M:%S')) ) for i in img

Re: python -i (interactive environment)

2005-03-08 Thread Steven Bethard
Joe wrote: Thanks, I knew about that but my question is why is it not working consistently? At the module level, locals() is globals(): py> locals() is globals() True And the globals() dict is modifiable. HTH, STeVe -- http://mail.python.org/mailman/listinfo/python-list

Re: python -i (interactive environment)

2005-03-08 Thread Joe
Thanks I thought that was also true for globals() but I now see that it is not. "Steven Bethard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Joe wrote: >> Thanks, I knew about that but my question is why is it not working >> consistently? > > At the module level, locals() is g

  1   2   >