XML RPC Problem....

2008-09-11 Thread Usman Ajmal
Hi everyone, I am trying to call a function named system.auth at the server side running at localhost:8080 but at the same time i want to set the http header. I found that header can be set by h.putheader("AUTHORIZATION", "Basic %s"%encodestring("%s:%s" % (ustring,text_ucert))) #us

Use Python to solve equations?

2008-09-11 Thread Kelie
Hello group, Is there any packages in Python that will help me solve functions similar to this: x = a*(1+bx)**2.5-c where a, b, c is known and the task to solve x? Thank you, Kelie -- http://mail.python.org/mailman/listinfo/python-list

Re: Refcount problem in ceval.c

2008-09-11 Thread Berthold Höllmann
Christian Heimes <[EMAIL PROTECTED]> writes: > Berthold Höllmann wrote: >> Is there any "common" reason to for such a strange object on the command >> stack, or is it more likely that any of my extension modules is causing >> havoc? > > It's very likely that your extension has a reference counting

Re: XML RPC Problem....

2008-09-11 Thread Fredrik Lundh
Usman Ajmal wrote: And i also fount that a typical system.auth call will look like: POST /xmlrpc/clarens_server.py HTTP/1.0 Host: localhost User-Agent: xmlrpclib.py/0.9.9 (by www.pythonware.com ) Content-Type: text/xml Content-Length: 105 AUTHORIZATION: Basic MkhVTm

Re: Use Python to solve equations?

2008-09-11 Thread James Mills
Hi Kelie, Check out sympy it is capable of doing things like this. cheers James On Thu, Sep 11, 2008 at 5:09 PM, Kelie <[EMAIL PROTECTED]> wrote: > Hello group, > > Is there any packages in Python that will help me solve functions > similar to this: > > x = a*(1+bx)**2.5-c where a, b, c is known

Re: dynamic allocation file buffer

2008-09-11 Thread Steven D'Aprano
On Wed, 10 Sep 2008 11:59:35 -0700, Aaron \"Castironpi\" Brady wrote: > On Sep 10, 5:24 am, Steven D'Aprano > <[EMAIL PROTECTED]> wrote: >> On Wed, 10 Sep 2008 09:26:20 +0200, Fredrik Lundh wrote: >> > Steven D'Aprano wrote: >> >> >> You've created a solution to a problem which (probably) only aff

Re: universal unicode font for reportlab

2008-09-11 Thread Duncan Booth
Tim Roberts <[EMAIL PROTECTED]> wrote: > Duncan Booth <[EMAIL PROTECTED]> wrote: >> >>Laszlo Nagy <[EMAIL PROTECTED]> wrote: >> >>> I need to use HTML anyway. I realized that universal unicode fonts >>> are above 5MB in size. The report would be a 10KB PDF, but I need to >>> embed the font before

Re: dict slice in python (translating perl to python)

2008-09-11 Thread Duncan Booth
hofer <[EMAIL PROTECTED]> wrote: > Let's take following perl code snippet: > > %myhash=( one => 1, two => 2, three => 3 ); > ($v1,$v2,$v3) = @myhash{qw(one two two)}; # <-- line of interest > print "$v1\n$v2\n$v2\n"; > > How do I translate the second line in a similiar compact way to

Re: universal unicode font for reportlab

2008-09-11 Thread Duncan Booth
Duncan Booth <[EMAIL PROTECTED]> wrote: > I may have made some blindingly obvious beginners mistake I made the blindingly stupid beginners mistake of cleaning up the code before posting it and breaking it in the process. The 'if' should of course say: if len(sys.argv) > 1: However my origi

Re: emulating read and readline methods

2008-09-11 Thread Sean Davis
On Sep 10, 7:54 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Sep 11, 8:01 am, MRAB <[EMAIL PROTECTED]> wrote: > > > > > On Sep 10, 6:59 pm, Sean Davis <[EMAIL PROTECTED]> wrote: > > > > I have a large file that I would like to transform and then feed to a > > > function (psycopg2 copy_from) that

Re: XML RPC Problem....

2008-09-11 Thread Usman Ajmal
Thanks for ur help. But now i am getting an error xmlrpclib.ProtocolError: Here is my code at http://privatepaste.com/d81Kut9AFj Any idea what wrong am i doing? On Thu, Sep 11, 2008 at 7:18 AM, Fredrik Lundh <[EMAIL PROTECTED]>wrote: > Usman Ajmal wrote: > > And i also fount that a typical

Re: dynamic allocation file buffer

2008-09-11 Thread Fredrik Lundh
Steven D'Aprano wrote: I'm no longer *claiming* anything, I'm *asking* whether random access to a 4GB XML file is something that is credible or useful. It is my understanding that XML is particularly ill-suited to random access once the amount of data is too large to fit in RAM. An XML file

Adding environment variables to bash.

2008-09-11 Thread aditya shukla
Hello folks Can i add any environment variable to bash from my python script? so that when i use env command then i can see that environment variable. Thanks Aditya -- http://mail.python.org/mailman/listinfo/python-list

Re: dict slice in python (translating perl to python)

2008-09-11 Thread Nick Craig-Wood
hofer <[EMAIL PROTECTED]> wrote: > Let's take following perl code snippet: > > %myhash=( one => 1, two => 2, three => 3 ); > ($v1,$v2,$v3) = @myhash{qw(one two two)}; # <-- line of interest > print "$v1\n$v2\n$v2\n"; > > How do I translate the second line in a similiar compact way

Re: max(), sum(), next()

2008-09-11 Thread Tino Wildenhain
Hi, Luis Zarrabeitia wrote: Quoting Laszlo Nagy <[EMAIL PROTECTED]>: ... Even better: help(sum) shows === sum(...) sum(sequence, start=0) -> value Returns the sum of a sequence of numbers (NOT strings) plus the value of parameter 'start'. When the sequence is empty, retur

Re: Use Python to solve equations?

2008-09-11 Thread Kelie
Thank you James! Checking it out right now... -- http://mail.python.org/mailman/listinfo/python-list

Re: Adding environment variables to bash.

2008-09-11 Thread Fredrik Lundh
aditya shukla wrote: Can i add any environment variable to bash from my python script? so that when i use env command then i can see that environment variable. not if you run the script from the shell. when a process starts, it gets a *copy* of the parent's environment. it can modify that c

Re: dict slice in python (translating perl to python)

2008-09-11 Thread Steven D'Aprano
On Thu, 11 Sep 2008 03:36:35 -0500, Nick Craig-Wood wrote: > As an ex-perl programmer and having used python for some years now, I'd > type the explicit > > v1,v2,v3 = mydict['one'], mydict['two'], mydict['two'] # 54 chars > > Or maybe even > > v1 = mydict['one'] # 54 chars > v2 = mydict[

Re: Gateway to python-list is generating bounce messages.

2008-09-11 Thread Steven D'Aprano
On Thu, 11 Sep 2008 15:25:57 +1000, Ben Finney wrote: >> > The bounce messages are sent to you because you sent the original. >> >> Wrong. I didn't send _any_ e-mail. Why should I get bounce messages? > > You asked for email to be sent, by sending a Usenet post to > comp.lang.python. That's wh

problem with interpreter

2008-09-11 Thread chusky
Hi ! I have Python installed on C:\Python25 Yesterday I added new "wx" library to the Python when I run C:\Python25\python.exe from the command line there is a problem with finding libraries: C:\Python25>python.exe Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on w

Is len O(n) or O(1) ?

2008-09-11 Thread process
Python uses arrays for lists right? def quicksort(lista): if lista == []: lista else: return quicksort([x for x in lista[1:] if x < lista[0]]) + [lista[0]] + \ quicksort([x for x in lista[1:] if x >= lista[0]]) or def quicksort(lista): if len(lista) ==

Re: Adding environment variables to bash.

2008-09-11 Thread John Lawrence
> > when a process starts, it gets a *copy* of the parent's environment. it > can modify that copy, but it cannot modify the variables in the parent. You can make a command use the current shell though if you use the '.' command e.g.: jl > cat env.sh export TEST='hello' jl > ./env.sh && env |

Re: Is len O(n) or O(1) ?

2008-09-11 Thread Fredrik Lundh
process wrote: Python uses arrays for lists right? len is O(1). for other operations, see http://effbot.org/zone/python-list.htm#performance > def quicksort(lista): > if lista == []: > lista better make that: def quicksort(lista): if not lista: return l

how dump a program which is running in memory

2008-09-11 Thread ruqiang826
hi I have written a service running backgroud to do something in linux. unfortunately,I deleted the source code by mistake, and I can still see the process running background using "ps aux" : username 13820 0.0 0.0 60368 2964 ?SAug20 0:33 python ./UpdateJobStatus.py I wonder if

Re: Is len O(n) or O(1) ?

2008-09-11 Thread Marc 'BlackJack' Rintsch
On Thu, 11 Sep 2008 02:23:43 -0700, process wrote: > Python uses arrays for lists right? `len()` on `list` objects is O(1). > def quicksort(lista): > if lista == []: > lista > else: > return quicksort([x for x in lista[1:] if x < lista[0]]) + > [lista[0]] + \ >

Re: Adding environment variables to bash.

2008-09-11 Thread Fredrik Lundh
John Lawrence wrote: You can make a command use the current shell though if you use the '.' command e.g.: jl > cat env.sh export TEST='hello' jl > ./env.sh && env | grep TEST #Doesn't set TEST in parent shell jl > . ./env.sh && env | grep TEST #Adding '. ' before the comman

Re: Gateway to python-list is generating bounce messages.

2008-09-11 Thread Fredrik Lundh
Steven D'Aprano wrote: I wasn't aware that comp.lang.python was a news-to-mail gateway. How can one tell the difference between news groups that use a news-to-mail gateway, and news groups that don't? by reading the group's FAQ, perhaps? http://www.faqs.org/faqs/python-faq/python-newsgroup-f

Re: Is there a SOAP module that can do this...?

2008-09-11 Thread thebjorn
On Sep 10, 9:44 pm, Waldemar Osuch <[EMAIL PROTECTED]> wrote: > On Sep 10, 1:23 pm, thebjorn <[EMAIL PROTECTED]> > wrote:> I've been trying to use SOAPpy and ZSI (with and without the use of > > wsdl2py) to communicate with a SOAP server (looks like it's a WebLogic > > server(?) in front of some en

Extracing data from webpage

2008-09-11 Thread srinivasan srinivas
Hi, I am trying to download data from a webpage. I use mechanize python module. Could someone tell me how to set/pass an agent like Mozilla or IE that we do in perl's WWW::Mechanize?? Thanks, Srini Be the first one to try the new Messenger 9 Beta! Go to http://in.messenger.yahoo.com/win

Re: Gateway to python-list is generating bounce messages.

2008-09-11 Thread Ben Finney
Steven D'Aprano <[EMAIL PROTECTED]> writes: > Nor do I believe that by posting a news message I've automatically > consented to receive email messages. To imply that the one implies the > other is equivalent to arguing that because I've written a letter to the > editor of a newspaper, I therefo

Re: dynamic allocation file buffer

2008-09-11 Thread Paul Boddie
On 11 Sep, 10:34, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > And as I said before, the only use case for *huge* XML files I've ever > seen used in practice is to store large streams of record-style data; I can imagine that the manipulation of the persistent form of large graph structures might b

Better error message on recursive import

2008-09-11 Thread Thomas Guettler
Hi, why does Python only raise ImportError if it fails caused by a recursive import? I know what's wrong. But I guess many beginner don't know what's wrong. I don't want much, just "RecursiveImportError" instead of "ImportError". Is this possible? Thomas -- Thomas Guettler, http://www.thoma

Re: Adding environment variables to bash.

2008-09-11 Thread John Lawrence
> > doesn't exactly work for Python scripts, though: > True, but you can use it in the following (admittedly messy) way: jl> cat setenv.sh /usr/bin/env python $@ . ./settmp rm settmp jl> cat env.py #!/usr/bin/python command = "export TEST='hello'\n" open('settmp', 'w').write(command) jl> . sete

Re: Extracing data from webpage

2008-09-11 Thread Uwe Schmitt
On 11 Sep., 11:55, srinivasan srinivas <[EMAIL PROTECTED]> wrote: > Hi, > I am trying to download data from a webpage. I use mechanize python module. > Could someone tell me how to set/pass an agent like Mozilla or IE that we do > in perl's WWW::Mechanize?? > > Thanks, > Srini > http://wwwsearch.

Re: Use Python to solve equations?

2008-09-11 Thread Uwe Schmitt
On 11 Sep., 09:09, Kelie <[EMAIL PROTECTED]> wrote: > Hello group, > > Is there any packages in Python that will help me solve functions > similar to this: > > x = a*(1+bx)**2.5-c where a, b, c is known and the task to solve x? > > Thank you, > > Kelie look at www.sagemath.com . it is great. gree

Re: I want to use a C++ library from Python

2008-09-11 Thread Uwe Schmitt
On 10 Sep., 09:57, Anders Eriksson <[EMAIL PROTECTED]> wrote: > Hello, > > I have a C++ library compiled as Windows DLL's. It consists of 32 .h and 1 > .lib and 1 .dll files. I don't have the source code. > > How can I create a Python module from these files? Do you need the full library including

Re: Accessing __slots__ from C

2008-09-11 Thread Hrvoje Niksic
[ You can use the capi-sig for questions like this; see http://mail.python.org/mailman/listinfo/capi-sig ] Chris <[EMAIL PROTECTED]> writes: > I'd like to be able to access an attribute of a particular Python > object as fast as possible from some C code. > > I wondered if using __slots__ to sto

Re: Persuading ConfigParser to give me the section elements in the same order as the file

2008-09-11 Thread geoffbache
Hi Matt, > Have a look at this:http://www.python.org/dev/peps/pep-0372/ > Thanks, that was very useful. Good to know these things are being considered. > Looking at the config parser module, it looks like there are only a > couple of places where {} is used. I would create a mixin class to > re

Re: how dump a program which is running in memory

2008-09-11 Thread Gerhard Häring
ruqiang826 wrote: hi I have written a service running backgroud to do something in linux. unfortunately,I deleted the source code by mistake, and I can still see the process running background using "ps aux" : username 13820 0.0 0.0 60368 2964 ?SAug20 0:33 python ./UpdateJobSta

Re: Extracing data from webpage

2008-09-11 Thread Alex
On Sep 11, 11:55 am, srinivasan srinivas <[EMAIL PROTECTED]> wrote: > Hi, > I am trying to download data from a webpage. I use mechanize python module. > Could someone tell me how to set/pass an agent like Mozilla or IE that we do > in perl's WWW::Mechanize?? > > Thanks, > Srini > >       Be the f

Re: formating a filesystem with python

2008-09-11 Thread Florian Diesch
"Ricardo Tiago" <[EMAIL PROTECTED]> wrote: > is there a package in python that allows to mount/umount and format > (to ext3) a filesystem? I know that this is possible by just calling > the os commands 'mount/umount and mkfs' but this would imply to have > to change sudoers to run the script as no

RE: removing text string

2008-09-11 Thread Ahmed, Shakir
Thanks Actually the number I am getting it is from slicing from a long text line. I need to slice 10 characters from that line but no string only numeric numbers. When I am slicing 10 characters those A, c, O is coming at the end. Thanks -Original Message- From: [EMAIL PROTECTED] [mail

Re: problem with interpreter

2008-09-11 Thread Fredrik Lundh
chusky wrote: File "C:\Python25\Lib\site-packages\wx-2.8-msw-ansi\wx\_core.py", line 5, in < module> import new File "new.py", line 1 import ^ SyntaxError: invalid syntax wxPython tries to import the module "new" from Python's standard library, but picks up a broken modul

Re: problem with interpreter

2008-09-11 Thread Diez B. Roggisch
chusky wrote: > Hi ! > > I have Python installed on C:\Python25 > Yesterday I added new "wx" library to the Python > > when I run C:\Python25\python.exe from the command line there is a > problem with finding libraries: > > C:\Python25>python.exe > Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:4

function return

2008-09-11 Thread Beema Shafreen
hi all, I have a script using functions , I have a problem in returning the result. My script returns only one line , i donot know where the looping is giving problem, Can any one suggest, why this is happening and let me know how to return all the lines def get_ptm(): fh = open('file.txt',

Re: how dump a program which is running in memory

2008-09-11 Thread Wojtek Walczak
On Thu, 11 Sep 2008 02:31:23 -0700 (PDT), ruqiang826 wrote: > I have written a service running backgroud to do something in linux. > unfortunately$B!$(BI deleted the source code by mistake, and I can still > see the process running background using "ps aux" : > > username 13820 0.0 0.0 60368

Re: removing text string

2008-09-11 Thread bearophileHUGS
Ahmed, Shakir: > Actually the number I am getting it is from slicing from a long text > line. I need to slice 10 characters from that line but no string only > numeric numbers. When I am slicing 10 characters those A, c, O is coming > at the end. It's better to avoid Regular expressions when they

Re: function return

2008-09-11 Thread Fredrik Lundh
Beema Shafreen wrote: I have a script using functions , I have a problem in returning the result. My script returns only one line , i donot know where the looping is giving problem, Can any one suggest, why this is happening and let me know how to return all the lines def get_ptm(): fh =

Re: function return

2008-09-11 Thread Fredrik Lundh
make that: note that you put the "return" statement inside the loop, so returning only one line is the expected behaviour. to fix this, you can append the result strings to the data_lis list inside the loop: result = "%s\t%s\t%s" %(id,gene_symbol,ptms) data_lis.append(r

Re: Python and Open Office

2008-09-11 Thread Peter Georgeson
On Sep 11, 7:04 am, "Colin J. Williams" <[EMAIL PROTECTED]> wrote: > Marco Bizzarri wrote: > > On Wed, Sep 10, 2008 at 10:04 PM, Greg Lindstrom <[EMAIL PROTECTED]> wrote: > >> Hello, > > >> I would like to create and manipulate Open Office documents using Python.   > >> I > >> have found then UNO P

RE: removing text string

2008-09-11 Thread Ahmed, Shakir
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Thursday, September 11, 2008 8:54 AM To: python-list@python.org Subject: Re: removing text string Ahmed, Shakir: > Actually the number I am getting it is from slicing from a long tex

catching exceptions from fortran

2008-09-11 Thread john
I wrapped some fortran code using F2PY and need to be able to catch fortran runtime errors to run the following: # "grid" is a wrapped fortran module # no runtime errors incurred when run with the correct inputs for filetype #--- def readGrid( self, coord='xyz'

Re: NumPy arrays that use memory allocated from other libraries or tools

2008-09-11 Thread Travis Oliphant
sturlamolden wrote: On Sep 10, 6:39 am, Travis Oliphant <[EMAIL PROTECTED]> wrote: I wanted to point anybody interested to a blog post that describes a useful pattern for having a NumPy array that points to the memory created by a different memory manager than the standard one used by NumPy.

Re: function return

2008-09-11 Thread Beema Shafreen
thanks for your valuable comments. I could solve the problem wiht your comments On Thu, Sep 11, 2008 at 7:07 PM, Fredrik Lundh <[EMAIL PROTECTED]>wrote: > make that: > > note that you put the "return" statement inside the loop, so returning >> only one line is the expected behaviour. >> > > to f

Re: Python and Open Office

2008-09-11 Thread Marco Bizzarri
Greg, as an addition to what I already said to you, you can consider taking a look at oood from ERP5 project http://wiki.erp5.org/HowToUseOood OOOd (openoffice.org daemon) runs openoffice behind the scene, and allows you to interact with it via XML-RPC; it should be quite robust, since it is acti

Re: function return

2008-09-11 Thread Matt Nordhoff
Beema Shafreen wrote: > hi all, > > I have a script using functions , I have a problem in returning the > result. My script returns only one line , i donot know where the looping > is giving problem, Can any one suggest, why this is happening and let me > know how to return all the lines > > def

Python platform.

2008-09-11 Thread [EMAIL PROTECTED]
Hello all; I wonder if there is a platform written in python. The equivalent of the Netbeans platform http://platform.netbeans.org/ in the Python world. Do you know such a thing? Thanks a lot. Jonathan. -- http://mail.python.org/mailman/listinfo/python-list

huge socket recv speed discrepancy between different OSs

2008-09-11 Thread Thorben Krueger
Do you see this too? Mor information and testcase here: http://bugs.python.org/issue3766 I would also be interested in the profiler output under windows. All the best Thorben -- http://mail.python.org/mailman/listinfo/python-list

Re: Python platform.

2008-09-11 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I wonder if there is a platform written in python. The equivalent of > the Netbeans platform http://platform.netbeans.org/ in the Python > world. Do you know such a thing? You (or maybe the Java folks) seem to have missed that platform has a rather specific meaning in

Enumerating ordered expat attributes with tuplets?

2008-09-11 Thread andy_westken
Hi I'm new to Python and trying to pick up good, idiomatic usage right from the offset. As I was familiar with Expat from C++ (directly and via expatpp) I'm trying to write a little script - using xml.parsers.expat - to search and replace XML attribute values. As I want the attributes to stay in

Re: Gateway to python-list is generating bounce messages.

2008-09-11 Thread Grant Edwards
On 2008-09-11, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Thu, 11 Sep 2008 15:25:57 +1000, Ben Finney wrote: > >>> > The bounce messages are sent to you because you sent the original. >>> >>> Wrong. I didn't send _any_ e-mail. Why should I get bounce messages? >> >> You asked for email to

Re: Enumerating ordered expat attributes with tuplets?

2008-09-11 Thread Manuel Ebert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Andy, by the looks of it I'd say that the problem is that the second parameter you passed to start_element is not a dictionary at all (the clue is in the "AttributeError: 'LIST' object" ...). >>> d = ['tree', 'house'] >>> start_element("Thin

Re: Python platform.

2008-09-11 Thread [EMAIL PROTECTED]
On Sep 11, 4:19 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > >  > I wonder if there is a platform written in python. The equivalent of >  > the Netbeans platformhttp://platform.netbeans.org/in the Python >  > world. Do you know such a thing? > > You (or maybe the Java f

Re: Enumerating ordered expat attributes with tuplets?

2008-09-11 Thread andy_westken
On Sep 11, 4:04 pm, Manuel Ebert <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi Andy, > > by the looks of it I'd say that the problem is that the second   > parameter you passed to start_element is not a dictionary at all (the   > clue is in the "AttributeError:

Re: Gateway to python-list is generating bounce messages.

2008-09-11 Thread Sjoerd Mullender
Grant Edwards <[EMAIL PROTECTED]> writes: > Could whoever is responsible for the gateway that is grabbing > my postings off of Usenet and e-mailing them out please fix the > headers in the mail messages so that I don't get the bounce > messages? > > While you're at it, might as well fix it for

Re: emulating read and readline methods

2008-09-11 Thread MRAB
On Sep 11, 9:23 am, Sean Davis <[EMAIL PROTECTED]> wrote: > On Sep 10, 7:54 pm, John Machin <[EMAIL PROTECTED]> wrote: > > > > > On Sep 11, 8:01 am, MRAB <[EMAIL PROTECTED]> wrote: > > > > On Sep 10, 6:59 pm, Sean Davis <[EMAIL PROTECTED]> wrote: > > > > > I have a large file that I would like to t

Re: Enumerating ordered expat attributes with tuplets?

2008-09-11 Thread Manuel Ebert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ah, well. Don't know whether it meets your aesthetic standards, but: >>> my_list = ['tree', 'hug', 'flower', 'hug', 'bear', 'run'] >>> my_list[0:len(a):2] ['tree', 'flower', 'bear'] >>> my_list[1:len(a):2] ['hug', 'hug', 'run'] and hence >>> zip(my_

Re: dict slice in python (translating perl to python)

2008-09-11 Thread hofer
Thanks a lot for all your answers. There's quite some things I learnt :-) [v1,v2,v3] = ... can be typed as v1,v2,v3 = . . . I also wasn't used to map(myhash.get, ['one', 'two', 'two']) itemgetter('one', 'one', 'two')(x) I also didn't know print "%(one)s\n%(two)s\n%(two)s" % mydict The reason

Re: dict slice in python (translating perl to python)

2008-09-11 Thread hofer
On Sep 11, 10:36 am, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: >I'd type the explicit > > v1,v2,v3 = mydict['one'], mydict['two'], mydict['two'] # 54 chars > Either > is only a couple more > characters to type.  It is completely > explicit and comprehensible to everyone, in comparison to > >  

Re: Enumerating ordered expat attributes with tuplets?

2008-09-11 Thread andy_westken
On Sep 11, 4:48 pm, Manuel Ebert <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Ah, well. Don't know whether it meets your aesthetic standards, but: >  >>> my_list = ['tree', 'hug', 'flower', 'hug', 'bear', 'run'] >  >>> my_list[0:len(a):2] > ['tree', 'flower', 'be

Re: Better error message on recursive import

2008-09-11 Thread Marc 'BlackJack' Rintsch
On Thu, 11 Sep 2008 12:43:34 +0200, Thomas Guettler wrote: > why does Python only raise ImportError if it fails caused by a recursive > import? > > I know what's wrong. But I guess many beginner don't know what's wrong. > I don't want much, just "RecursiveImportError" instead of "ImportError". >

Re: dict slice in python (translating perl to python)

2008-09-11 Thread bearophileHUGS
hofer: > The real example would be more like: > name,age,country = itemgetter('name age country'.split())(x) # or any > of my above versions That solution is very clever, and the inventor smart, but it's too much out of standard and complex to be used in normal real code. Learning tricks is useful

Re: Gateway to python-list is generating bounce messages.

2008-09-11 Thread Grant Edwards
On 2008-09-11, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Wed, 10 Sep 2008 21:36:36 -0500, Grant Edwards <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > >> Wrong. I didn't send _any_ e-mail. Why should I get bounce >> messages? >> > One: Comp.lang.python is dua

conditional install/distribution

2008-09-11 Thread i3dmaster
Is there a feature in distutils or easy_install to specify what version of python that the target package can be installed? For example, if a package has a module that only needed if the python version < 2.6, is there a way to specifiy that in setup.py or easy_install cfg file so that when installi

Please help me finding a way to implement os.path.issubpath(a, b)

2008-09-11 Thread Giampaolo Rodola'
Hi, I'm trying to implement a function which returns whether a path is a subpath of another one (e.g. /a/b/c is a subpath of /a/b). I wrote this function which apparently seems to work fine: import os def issubpath(path1, path2): """Return True if path1 is a sub path of path2.""" if path1

Re: Python platform.

2008-09-11 Thread [EMAIL PROTECTED]
On Sep 11, 11:13 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Sep 11, 4:19 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > > > [EMAIL PROTECTED] wrote: > > >  > I wonder if there is a platform written in python. The equivalent of > >  > the Netbeans platformhttp://platform.netbeans.or

Re: XML-RPC "filter"

2008-09-11 Thread Richard Levasseur
On Sep 10, 2:04 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb: > > > > > On 9 Set, 17:55, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> I would go for a slightly different approach: make your server have a > >> dispatch-method that delegates the calls to the und

Re: Python platform.

2008-09-11 Thread bearophileHUGS
carriere.jonat...: > I want to build a desktop application. I am searching for some kind of > environment that would provide all the elements ready (Windows...). > Then I would have to code the business logic only. I don't think there's such thing in Python, "all elements ready" sounds strange :-)

Re: Python platform.

2008-09-11 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: I want to build a desktop application. I am searching for some kind of environment that would provide all the elements ready (Windows...). Then I would have to code the business logic only. start here: http://wiki.python.org/moin/GuiProgramming The big ones are Tki

Re: Use Python to solve equations?

2008-09-11 Thread Kelie
On Sep 11, 1:11 am, Uwe Schmitt <[EMAIL PROTECTED]> wrote: > > Kelie > > look atwww.sagemath.com. it is great. > > greetings, uwe Thanks Uwe! -- http://mail.python.org/mailman/listinfo/python-list

ReportLab 2.2 has been released

2008-09-11 Thread Robin Becker
Version 2.2 of the ReportLab open-source toolkit is out! You find downloads and src instructions at http://www.reportlab.org/downloads.html. Contributions = Thanks to everybody who has contributed to the open-source toolkit in the run-up to the 2.2 release, whether by reporting bugs

Re: Is there a SOAP module that can do this...?

2008-09-11 Thread Stefan Behnel
thebjorn wrote: > I've been trying to use SOAPpy and ZSI (with and without the use of > wsdl2py) to communicate with a SOAP server (looks like it's a WebLogic > server(?) in front of some enterprise java bean) and not having much > luck. Have you tried using soaplib? I find it very usable and from

How to Determine Name of the Day in the Week

2008-09-11 Thread Henry Chang
Instead of getting integers with weekday(), Monday == 0 ... Sunday == 6; is there a way to get the actual names, such as "Monday ... Sunday"? I would like to do this without creating a data mapping. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: dict slice in python (translating perl to python)

2008-09-11 Thread Fredrik Lundh
hofer wrote: The real example would be more like: name,age,country = itemgetter('name age country'.split())(x) ouch. if you do this a lot (=more than once), just wrap your dictionaries in a simple attribute proxy, and use plain attribute access. that is, given class AttributeWrapper:

Re: How to Determine Name of the Day in the Week

2008-09-11 Thread Fredrik Lundh
Henry Chang wrote: Instead of getting integers with weekday(), Monday == 0 ... Sunday == 6; is there a way to get the actual names, such as "Monday ... Sunday"? I would like to do this without creating a data mapping. :) if you have a datetime or date object, you can use strftime with the

Re: dynamic allocation file buffer

2008-09-11 Thread Aaron "Castironpi" Brady
On Sep 11, 2:40 am, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Wed, 10 Sep 2008 11:59:35 -0700, Aaron \"Castironpi\" Brady wrote: > > On Sep 10, 5:24 am, Steven D'Aprano > > <[EMAIL PROTECTED]> wrote: > >> On Wed, 10 Sep 2008 09:26:20 +0200, Fredrik Lundh wrote: > >> > Steven D'Aprano wrote: >

Re: How to Determine Name of the Day in the Week

2008-09-11 Thread Henry Chang
Awesome, that worked. Thanks so much! On Thu, Sep 11, 2008 at 10:16 AM, Fredrik Lundh <[EMAIL PROTECTED]>wrote: > Henry Chang wrote: > > Instead of getting integers with weekday(), Monday == 0 ... Sunday == 6; >> is there a way to get the actual names, such as "Monday ... Sunday"? I >> would l

Re: dynamic allocation file buffer

2008-09-11 Thread Aaron "Castironpi" Brady
On Sep 11, 5:35 am, Paul Boddie <[EMAIL PROTECTED]> wrote: > On 11 Sep, 10:34, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > > > And as I said before, the only use case for *huge* XML files I've ever > > seen used in practice is to store large streams of record-style data; > > I can imagine that t

Re: Enumerating ordered expat attributes with tuplets?

2008-09-11 Thread MRAB
On Sep 11, 4:48 pm, Manuel Ebert <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Ah, well. Don't know whether it meets your aesthetic standards, but: >  >>> my_list = ['tree', 'hug', 'flower', 'hug', 'bear', 'run'] >  >>> my_list[0:len(a):2] > ['tree', 'flower', 'be

Re: dict slice in python (translating perl to python)

2008-09-11 Thread Aaron "Castironpi" Brady
On Sep 11, 10:52 am, hofer <[EMAIL PROTECTED]> wrote: > On Sep 11, 10:36 am, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > > >I'd type the explicit > > >  v1,v2,v3 = mydict['one'], mydict['two'], mydict['two'] # 54 chars > Either > > is only a couple more > > characters to  type.  It is completely

Re: Please help me finding a way to implement os.path.issubpath(a, b)

2008-09-11 Thread Arnaud Delobelle
On Sep 11, 5:40 pm, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > Hi, > I'm trying to implement a function which returns whether a path is a > subpath of another one (e.g. /a/b/c is a subpath of /a/b). > I wrote this function which apparently seems to work fine: > > import os > > def issubpath(p

Re: conditional install/distribution

2008-09-11 Thread Diez B. Roggisch
i3dmaster schrieb: Is there a feature in distutils or easy_install to specify what version of python that the target package can be installed? For example, if a package has a module that only needed if the python version < 2.6, is there a way to specifiy that in setup.py or easy_install cfg file

Re: Please help me finding a way to implement os.path.issubpath(a, b)

2008-09-11 Thread Diez B. Roggisch
Giampaolo Rodola' schrieb: Hi, I'm trying to implement a function which returns whether a path is a subpath of another one (e.g. /a/b/c is a subpath of /a/b). I wrote this function which apparently seems to work fine: import os def issubpath(path1, path2): """Return True if path1 is a sub p

Re: shelve file name extention

2008-09-11 Thread Monu
On Sep 8, 1:47 pm, [EMAIL PROTECTED] wrote: >     Monu> When I am using shelve on my local machine it generates the db >     Monu> file as given filename. But in another machine it's generating >     Monu> .dat and .dir.  can anyone tell me how can I force sheve >     Monu> module to write the db i

Re: shelve file name extention

2008-09-11 Thread Monu
On Sep 8, 1:47 pm, [EMAIL PROTECTED] wrote: >     Monu> When I am using shelve on my local machine it generates the db >     Monu> file as given filename. But in another machine it's generating >     Monu> .dat and .dir.  can anyone tell me how can I force sheve >     Monu> module to write the db i

Re: Please help me finding a way to implement os.path.issubpath(a, b)

2008-09-11 Thread Fredrik Lundh
Diez B. Roggisch wrote: Any reason why os.path.normpath(a).startswith(os.normpath(b)) doesn't do the trick? Except for the trivial type, you mean? That depends on whether "c:\foo" should be seen as a subpath to "c:\foobar" or not. I'd probably go for (also untested): def issubpath(a, b)

wx

2008-09-11 Thread Desmond Scott E
I'm am a Python novice by chance not choice. (Although it appears to be a nice tool. Plus anything based on Monte Python can't be bad!) My Quest is to migrate a Python-based process from Windows2000/Python v2.4.2 (#67) to WindowsXP/Python v2.5.2 (r252:60911). I've searched the Python website and

Re: shelve file name extention

2008-09-11 Thread Fredrik Lundh
Monu wrote: So Can't I choose which module to use. Is there any preferance on which shelve chooses these modules? it uses the anydbm module to look for available DBM-style drivers, which looks for modules in the following order: dbhash, gdbm, dbm, dumbdbm. if you know which one you want, yo

Re: wx

2008-09-11 Thread Nikola Stjelja
The module you are talking about is a python GUI toolkit named WxPython, which is a port of the cross platform C++ GUI toolkit wxwidgets. It's an excelent gui toolkit , easy to learn and code on. Well documented and has an excelent community around it. Here are the links for both sites: http://www.

Re: wx

2008-09-11 Thread Fredrik Lundh
Desmond Scott E wrote: I'm am a Python novice by chance not choice. (Although it appears to be a nice tool. Plus anything based on Monte Python can't be bad!) My Quest is to migrate a Python-based process from Windows2000/Python v2.4.2 (#67) to WindowsXP/Python v2.5.2 (r252:60911). I've s

  1   2   >