Re: Single-instance daemons

2008-11-12 Thread Irmen de Jong
Jeffrey Barish wrote: Nice. One thing: how do I get the uid and gid for the target user? In general, I know the name of the target user, but the uid/gid assigned by the OS to that user could be different on different systems. pwd.getpwnam grp.getgrnam --irmen -- http://mail.python.org/mailm

Python Wrapper Tools; a Performance Study

2008-11-12 Thread Srijit Kumar Bhadra
I am looking for the file Python Wrapper Tools; a Performance Study (http://people.web.psi.ch/geus/talks/europython2004_geus.pdf). The link seems to be no longer valid. If someone has a local copy, I request him/her to share it. /Srijit -- http://mail.python.org/mailman/listinfo/python-list

Re: memory mapped tar file contents

2008-11-12 Thread Aaron Brady
On Nov 12, 8:51 pm, Chris Brooks <[EMAIL PROTECTED]> wrote: > Hi, > > I would like to read directly from a tar file into memory so I can > manipulate a file (quickly) and write its changes out to another file.  I > thought I could do something like: > > #!/usr/bin/env python > > import tarfile > im

Re: duck-type-checking?

2008-11-12 Thread greg
Joe Strout wrote: I'd rather risk something that breaks the code in an obvious way during development, than risk something that breaks it in a subtle way and is more likely to be discovered by the end-user. Seems to me that putting in these kinds of assertions isn't going to make much diff

Re: duck-type-checking?

2008-11-12 Thread greg
Joe Strout wrote: This is not hypothetical -- just last week I had a hard-to-track-down abend that ultimately turned out to be an NLTK.Tree object stored someplace that I expected to only contain strings. I found it by littering my code with assertions of the form isinstance(foo,basestrin

Re: memory mapped tar file contents

2008-11-12 Thread Chris Brooks
Jean-Paul Calderone wrote: > > If you mmap a tar file, then you'll get a bunch of tar formatted stuff. > If > you mmap a gzipped tar file, then you'll get a bunch of gzipped stuff. > Are > you sure that's what you want? From your code snippet, it looks more like > you want the uncompressed f

Re: Printing a "status " line from a python script

2008-11-12 Thread Alex VanderWoude
Chris Seymour wrote: I am working on a python script for my colleague that will walk a directory and search in the different files for a specific string. These pieces I am able to do. What my colleague wants is that when she runs the script the filename is replaced by the current file that is be

Re: cannot pickle object returned by urllib2.urlopen()

2008-11-12 Thread greg
On Wed, 12 Nov 2008 11:00:26 +0800, scsoce wrote: got a exception: "a class that defines __slots__ without defining __getstate__ cannot be pickled " why? Because in the absence of any other information, the default way of pickling an object is to save the contents of its __dict__. But an obje

Re: Single-instance daemons

2008-11-12 Thread Jeffrey Barish
Cameron Simpson wrote: > Or, more simply, get root to make an empty pid file once and chown it to > the daemon user. Then the daemon can rewrite the file as needed. You need > to move to truncating the file instead of removing it on daemon shutdown, > but that is trivial. And no mucking with privi

Easy caching

2008-11-12 Thread jalanb3
Evening all, And thank you for your valuable reading skills. The following pattern turned up in coding tonight. It works, but I'm suspicious, it just seems too easy. So any comments or constructive criticisms welcome ? *** Start doctest format *** >>> class Cacher: ... def

Re: Single-instance daemons

2008-11-12 Thread Jeffrey Barish
Jeff McNeil wrote: > Sure, start the daemon as root, write the appropriate files, and then > drop permissions using os.setegid and then os.seteuid. You can chown > the file before priv. drop to your target user so that it can be > removed when your exit handlers run.  Alternatively, you can reclai

Re: need to suspend/resume a child thread

2008-11-12 Thread Miki
Hello, > A child thread has a long-time executions, how to suspend it and resume > back the orignial place ? I don't think you can do it using Python's thread API. You can either use a platform specific API (such as pywin32) or make the thread "cooperative" and wait on a condition/semaphore in som

Re: Finding the instance reference of an object

2008-11-12 Thread Craig Allen
> arguably even older than that to Lisp. > Firstly, thanks to those that have responded to my part in this debate, I have found it very informative and interesting as I have the entire thread. However, with regard to comments that I led myself astray, I want to reiterate the one thing I find det

Re: what should we use instead of the 'new' module?

2008-11-12 Thread Robert Kern
[EMAIL PROTECTED] wrote: Robert, Appreciate your response. However Guido says here that types was never intended to be used like that: http://bugs.python.org/msg58023 quote: "The types module was only ever intended for type checking, not for creating new instances. The correct solution will

Re: what should we use instead of the 'new' module?

2008-11-12 Thread Benjamin
On Nov 12, 9:54 pm, [EMAIL PROTECTED] wrote: > Robert, > > Appreciate your response. > > However Guido says here that types was never intended to be used like > that: > > http://bugs.python.org/msg58023 > > quote: "The types module was only ever intended for type > checking, not for creating new in

Re: what should we use instead of the 'new' module?

2008-11-12 Thread flrump
Robert, Appreciate your response. However Guido says here that types was never intended to be used like that: http://bugs.python.org/msg58023 quote: "The types module was only ever intended for type checking, not for creating new instances. The correct solution will be to use whatever we end u

potential bug in UnixMailbox method of Python

2008-11-12 Thread Sirshendu Rakshit
Hi,I am using UnixMailbox to parse an mbox file. This mbox file starts with the following lines.From [EMAIL PROTECTED] May 18 01:43:12 2004>From [EMAIL PROTECTED] May 18 01:43:12 2004ReturnPath: XOriginalTo: [EMAIL PROTECTED]: [EMAIL PROTECTED] what I am seeing is that the '>From [EMAIL PROTECTE

Re: what should we use instead of the 'new' module?

2008-11-12 Thread Robert Kern
Flavio wrote: How is this code going to look like in Python 3.0? (it's deprecated according to http://docs.python.org/library/new.html#module-new, but it does not tell what to use instead) method = new.instancemethod(raw_func, None, cls) setattr(cls, name, method) Use the type objects in the

what should we use instead of the 'new' module?

2008-11-12 Thread Flavio
How is this code going to look like in Python 3.0? (it's deprecated according to http://docs.python.org/library/new.html#module-new, but it does not tell what to use instead) method = new.instancemethod(raw_func, None, cls) setattr(cls, name, method) Can we write code in python2.5/2.6 that will

Re: concurrency program design stackless python tasklet or python thread?

2008-11-12 Thread davy zhang
thank you very much for the advices! I asked myself many times, why not just use thread:D After some research I found thread has some fatal defects 1. thread number is limited by os, that means the system don't want you start many threads at the same time 2. thread pool is another approach for c

Re: memory mapped tar file contents

2008-11-12 Thread Jean-Paul Calderone
On Wed, 12 Nov 2008 18:51:38 -0800 (PST), Chris Brooks <[EMAIL PROTECTED]> wrote: Hi, I would like to read directly from a tar file into memory so I can manipulate a file (quickly) and write its changes out to another file. I thought I could do something like: If you mmap a tar file, then y

memory mapped tar file contents

2008-11-12 Thread Chris Brooks
Hi, I would like to read directly from a tar file into memory so I can manipulate a file (quickly) and write its changes out to another file. I thought I could do something like: #!/usr/bin/env python import tarfile import mmap fil = tarfile.open( "out.tar.gz" , "r:gz" ) tarinf = fil.next() m

Re: duck-type-checking?

2008-11-12 Thread Steven D'Aprano
On Wed, 12 Nov 2008 08:06:31 -0700, Joe Strout wrote: > Let me preface this by saying that I think I "get" the concept of duck- > typing. > > However, I still want to sprinkle my code with assertions that, for > example, my parameters are what they're supposed to be -- too often I > mistakenly pa

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-12 Thread George Sakkis
On Nov 12, 4:05 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > greg wrote: > >> It's not only misleading, it's also a seriously flawed reading of the > >> original text - the Algol 60 report explicitly talks about assignment > >> of *values*. > > > Do you agree that an expression in Python has a v

Re: PIL's ImageFile Parser and PNG's

2008-11-12 Thread Silfheed
On Nov 12, 5:28 pm, Silfheed <[EMAIL PROTECTED]> wrote: > Heyas > > So I've been messing around with the PIL and PNG's and came across a > little problem with PNG's. > > So just to clarify, I'm running with the standard ubuntu 8.04 python- > imaging package that installs zlib and all the other good

need to suspend/resume a child thread

2008-11-12 Thread scsoce
A child thread has a long-time executions, how to suspend it and resume back the orignial place ? I know it' nature to use singal, but child thread cannot get signal as Python Manual say. And i dnt like to check status variable as the long-time executions can not or be dirty to stop to do c

email questions

2008-11-12 Thread ted & irma slage
I tried to get a message to the below email address and this information was sent back to me. Can you help me find out why it would not go through, or send it to the place that may help me? Thank you, Irma Slage [EMAIL PROTECTED] The error that the other server returned was: 553 553 5.3.0 <[

Re: best python unit testing framwork

2008-11-12 Thread Timothy Grant
On Wed, Nov 12, 2008 at 5:16 PM, Roy Smith <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > "Timothy Grant" <[EMAIL PROTECTED]> wrote: > >> I wanted to like unittest but couldn't. So I started using py.test. I >> even wrote a plugin for TextMate to interface with py.test. If I had >>

PIL's ImageFile Parser and PNG's

2008-11-12 Thread Silfheed
Heyas So I've been messing around with the PIL and PNG's and came across a little problem with PNG's. So just to clarify, I'm running with the standard ubuntu 8.04 python- imaging package that installs zlib and all the other goodies that go along to make the PIL work with PNG's nicely. So this w

Re: duck-type-checking?

2008-11-12 Thread Terry Reedy
Joe Strout wrote: On Nov 12, 2008, at 2:42 PM, Tim Rowe wrote: True. I love the ABC approach; now I just have to figure out whether I love it enough to move our entire company over to 2.6 (despite 2.5's great advantage that it's pre-installed on every Mac by default), or whether instead I'l

Re: best python unit testing framwork

2008-11-12 Thread Roy Smith
In article <[EMAIL PROTECTED]>, "Timothy Grant" <[EMAIL PROTECTED]> wrote: > I wanted to like unittest but couldn't. So I started using py.test. I > even wrote a plugin for TextMate to interface with py.test. If I had > known about Nose I would likely have used it instead because it is > built on

Re: Using the result of type() in a boolean statement?

2008-11-12 Thread Scott David Daniels
dpapathanasiou wrote: ... I'd like to define a loop like this, ... for key, value in my_dict.items(): if type{value) is : # do the dictionary logic elif type(value) is : # do the string logic # etc You're searching for "isinstance" (or possibly issubclass) for key, value in my_d

Re: Python 2.5 and sqlite

2008-11-12 Thread david . lyon
Thorsten, Quoting Thorsten Kampe <[EMAIL PROTECTED]>: * (Tue, 11 Nov 2008 17:58:15 -0500) > > Can you ask them if sqlite3 is installed? and if not... to install > > it? > > Why would he have to install SQLite?! Seems a stupid question. If he wants to use SQLite... it needs to be on the syst

Re: Single-instance daemons

2008-11-12 Thread Cameron Simpson
On 12Nov2008 14:07, Jeff McNeil <[EMAIL PROTECTED]> wrote: | On Nov 12, 4:57 pm, Jeffrey Barish <[EMAIL PROTECTED]> wrote: | > As per Stevens/Rago, "file and record locking provides a convenient | > mutual-exclusion mechanism". They note the convention of putting the lock | > file in /var/run in a

Re: loading modules, metaclasses, chicken & eggs

2008-11-12 Thread Aaron Brady
On Nov 12, 3:01 pm, sandro <[EMAIL PROTECTED]> wrote: > Aaron Brady wrote: > > On Nov 12, 9:38 am, sandro <[EMAIL PROTECTED] wrote: > >> Hi, > >> Is there a way to solve this? I'd like ro force a reload of the > >> metaclass after 'debug'  has been loaded and debug.DBG set to True, > >> but that do

Re: Single-instance daemons

2008-11-12 Thread Jeff McNeil
On Nov 12, 4:57 pm, Jeffrey Barish <[EMAIL PROTECTED]> wrote: > As per Stevens/Rago, "file and record locking provides a convenient > mutual-exclusion mechanism". They note the convention of putting the lock > file in /var/run in a file called .pid, where is the name of > the daemon and content i

Single-instance daemons

2008-11-12 Thread Jeffrey Barish
As per Stevens/Rago, "file and record locking provides a convenient mutual-exclusion mechanism". They note the convention of putting the lock file in /var/run in a file called .pid, where is the name of the daemon and content is the pid. Seems like a good suggestion as I see pid files from many

Re: Are there any FOSS Python Single-Sign-on Servers?

2008-11-12 Thread Ben Finney
Phillip B Oldham <[EMAIL PROTECTED]> writes: > So... are there any good OpenID/OAuth servers written in python? Rather than continue the discussion in this thread, I'll point you to the starting point for further information at the OpenID site http://openid.net/developers/>. Good hunting! --

Re: Simple question about Python lists

2008-11-12 Thread Scott David Daniels
Eric wrote: ... In MATLAB, if I just want the first, fifth and eighth element I might do something like this: b = a([1 5 8]); On Nov 11, 1:51 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> replied: b = [a[i] for i in [1, 5, 8]] To which Eric said: Thanks! It makes sense, but in this cas

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-12 Thread Aahz
In article <[EMAIL PROTECTED]>, Grant Edwards <[EMAIL PROTECTED]> wrote: >On 2008-11-12, Steve Holden <[EMAIL PROTECTED]> wrote: >> greg wrote: > >I stopped paying much attention to this thread a while ago, but >you've got to admire the persistence of somebody who soldiers >on even though Aahz, Fr

Re: duck-type-checking?

2008-11-12 Thread Joe Strout
On Nov 12, 2008, at 2:42 PM, Tim Rowe wrote: And then the original class definition changes -- new members added -- but the ones from the factory class don't change, and so are no longer compliant with the the factory class (which doesn't support the new "form_pun_relating_to_avoiding_a_high_haz

Re: [Python-Dev] Python 2.5.3: call for patches

2008-11-12 Thread Martin v. Löwis
>> In principle, this is fine with me, so go ahead. > > Done. Thanks for looking into these! Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: duck-type-checking?

2008-11-12 Thread Tim Rowe
2008/11/12 Joe Strout <[EMAIL PROTECTED]>: >> If you need to know that it walks like a duck, mates like a duck and >> tastes like a duck when roasted, you probably want it to really /be/ a >> duck and should go back to inheritance. > > I can't agree; there are times when inheritance just won't do,

Re: Null object pattern

2008-11-12 Thread Robin Becker
Ben Finney wrote: Terry Reedy <[EMAIL PROTECTED]> writes: We're not going to add the "feature" back that None compares smaller than everything. It's a slippery slope that ends with all operations involving None returning None -- I've seen a proposal made in all earnestness requesting that None+

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-12 Thread Fredrik Lundh
greg wrote: It's not only misleading, it's also a seriously flawed reading of the original text - the Algol 60 report explicitly talks about assignment of *values*. Do you agree that an expression in Python has a value? > Do you agree that it makes sense to talk about assigning that value t

Re: loading modules, metaclasses, chicken & eggs

2008-11-12 Thread sandro
Aaron Brady wrote: > On Nov 12, 9:38 am, sandro <[EMAIL PROTECTED] wrote: >> Hi, >> Is there a way to solve this? I'd like ro force a reload of the >> metaclass after 'debug'  has been loaded and debug.DBG set to True, >> but that doesn't seem to happen... >> >> Any hints? >> >> sandro >> *:-) >>

Re: Installing Python 2.6 on Vista

2008-11-12 Thread Scott David Daniels
Martin v. Löwis wrote: It installs fine for 'just me', so no problem. It installs for 'just me', but it doesn't work. Just try starting IDLE, or import the socket module. Regards, Martin See bug 3296 (and its patch). If the import produces a warning, Idle's improper use of the format_warning

Re: pysqlite install error on hp ux (ld: Can't find library for -lpython2.5)

2008-11-12 Thread Gerhard Häring
Geon. wrote: hi everyone! when i install pysqlite i meet bellow error. ( use easy_install and source code building same problem ) ld: Can't find library for -lpython2.5 what mean this message? and what i do? my system is hp-ux 11i v3. and python2.5 is installed. ld command also avaliable. I

Re: loading modules, metaclasses, chicken & eggs

2008-11-12 Thread Aaron Brady
On Nov 12, 9:38 am, sandro <[EMAIL PROTECTED]> wrote: > Hi, > Is there a way to solve this? I'd like ro force a reload of the > metaclass after 'debug'  has been loaded and debug.DBG set to True, > but that doesn't seem to happen... > > Any hints? > > sandro > *:-) > > sqlkit:  http://sqlkit.argoli

Re: duck-type-checking?

2008-11-12 Thread Joe Strout
On Nov 12, 2008, at 11:48 AM, [EMAIL PROTECTED] wrote: It seems to me that what you are describing is exactly what abcs were added for in 2.6, in particular registration: class AnotherClass(metaclass=ABCMeta): pass AnotherClass.register(basestring) assert isinstance(str, AnotherClass) Plea

Re: duck-type-checking?

2008-11-12 Thread George Sakkis
On Nov 12, 1:35 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > Cristina Yenyxe González García wrote: > > > 2008/11/12 Joe Strout <[EMAIL PROTECTED]>: > >> So I need functions to assert that a given identifier quacks like a string, > >> or a number, or a sequence, or a mutable sequence, or a certain

Re: pygoocanvas binaries for windows?

2008-11-12 Thread Mike Driscoll
On Nov 12, 11:16 am, sandro <[EMAIL PROTECTED]> wrote: > Hi, > >   I really need binaries for goocanva s for windows. >   There are plenty of places in innternet of people that tried to >   compile with no success. Have anybody of you managed to get them? > > thanks > sandro Are you talking about

Re: My first Python program -- a lexer

2008-11-12 Thread Thomas Mlynarczyk
Steve Holden schrieb: Suppose I use the dict and I want to access the regex associatetd with the token named "tokenname" (that is, no iteration, but a single access). I could simple write tokendict["tokenname"]. But with the list of tuples, I can't think of an equally easy way to do that. But th

Re: best python unit testing framwork

2008-11-12 Thread Timothy Grant
On Tue, Nov 11, 2008 at 2:59 PM, Brendan Miller <[EMAIL PROTECTED]> wrote: > What would heavy python unit testers say is the best framework? > > I've seen a few mentions that maybe the built in unittest framework > isn't that great. I've heard a couple of good things about py.test and > nose. Are t

Re: Does Python mess with CRLFs?

2008-11-12 Thread Irmen de Jong
Gilles Ganault wrote: Hello I'm stuck at understanding why Python can't extract some bit from an HTML file using regexes, although I can find it just fine with UltraEdit. #BAD friends = re.compile('\r\n\r\n',re.IGNORECASE | re.MULTILINE | re.DOTALL) If you keep running into trouble and

Re: duck-type-checking?

2008-11-12 Thread pruebauno
On Nov 12, 1:22 pm, Joe Strout <[EMAIL PROTECTED]> wrote: > On Nov 12, 2008, at 10:45 AM, Tim Rowe wrote: > > > What do you actually mean by "Quacks like a string"? Supports the > > 'count()' method? Then you find out if it doesn't when you try to > > apply the 'count()' method. Supports some metho

Re: Using the result of type() in a boolean statement?

2008-11-12 Thread Terry Reedy
dpapathanasiou wrote: If I define a dictionary where one or more of the values is also a dictionary, e.g.: my_dict={"a":"string", "b":"string", "c":{"x":"0","y":"1"}, "d":"string"} How can I use the output of type() so I can do one thing if the value is a string, and another if the value is a d

Re: Does Python mess with CRLFs?

2008-11-12 Thread Irmen de Jong
Gilles Ganault wrote: On Wed, 12 Nov 2008 12:04:07 +0100, Gilles Ganault <[EMAIL PROTECTED]> wrote: I wonder if Python rewrites CRLFs when reading a text file with open/read? For those seeing the same thing, the answer is yes: On Windows, the code above turns CRLF into LF. I tried "rb" instea

Re: duck-type-checking?

2008-11-12 Thread Terry Reedy
Cristina Yenyxe González García wrote: 2008/11/12 Joe Strout <[EMAIL PROTECTED]>: So I need functions to assert that a given identifier quacks like a string, or a number, or a sequence, or a mutable sequence, or a certain class, or so on. (On the class check: I know about isinstance, but that's

Re: duck-type-checking?

2008-11-12 Thread Terry Reedy
Joe Strout wrote: Let me preface this by saying that I think I "get" the concept of duck-typing. However, I still want to sprinkle my code with assertions that, for example, my parameters are what they're supposed to be -- too often I mistakenly pass in something I didn't intend, and when tha

Re: How can a function know what module it's in?

2008-11-12 Thread Arnaud Delobelle
Joe Strout <[EMAIL PROTECTED]> writes: > I've been using docstring to exercise each of my modules, with code > like this: > > def _test(): > import doctest > doctest.testmod() > > if __name__ == "__main__": > _test() > > > This works great when I execute each module by itself. H

Re: duck-type-checking?

2008-11-12 Thread Joe Strout
On Nov 12, 2008, at 10:45 AM, Tim Rowe wrote: What do you actually mean by "Quacks like a string"? Supports the 'count()' method? Then you find out if it doesn't when you try to apply the 'count()' method. Supports some method that you don't actually use? Then why do you care? Because if I wri

Re: duck-type-checking?

2008-11-12 Thread Tim Rowe
2008/11/12 Joe Strout <[EMAIL PROTECTED]>: > Let me preface this by saying that I think I "get" the concept of > duck-typing. > > However, I still want to sprinkle my code with assertions that, for example, > my parameters are what they're supposed to be -- too often I mistakenly pass > in somethin

Re: duck-type-checking?

2008-11-12 Thread Cristina Yenyxe González García
2008/11/12 Joe Strout <[EMAIL PROTECTED]>: > > So I need functions to assert that a given identifier quacks like a string, > or a number, or a sequence, or a mutable sequence, or a certain class, or so > on. (On the class check: I know about isinstance, but that's contrary to > duck-typing -- what

Re: duck-type-checking?

2008-11-12 Thread Matimus
On Nov 12, 7:06 am, Joe Strout <[EMAIL PROTECTED]> wrote: > Let me preface this by saying that I think I "get" the concept of duck- > typing. > > However, I still want to sprinkle my code with assertions that, for   > example, my parameters are what they're supposed to be -- too often I   > mistake

Using the result of type() in a boolean statement?

2008-11-12 Thread dpapathanasiou
If I define a dictionary where one or more of the values is also a dictionary, e.g.: my_dict={"a":"string", "b":"string", "c":{"x":"0","y":"1"}, "d":"string"} How can I use the output of type() so I can do one thing if the value is a string, and another if the value is a dictionary? i.e., I'd li

pygoocanvas binaries for windows?

2008-11-12 Thread sandro
Hi, I really need binaries for goocanva s for windows. There are plenty of places in innternet of people that tried to compile with no success. Have anybody of you managed to get them? thanks sandro -- http://mail.python.org/mailman/listinfo/python-list

Re: help me~!!!'tuple' object has no attribute 'compile'

2008-11-12 Thread Peter Pearson
On Wed, 12 Nov 2008 02:07:46 -0800 (PST), [EMAIL PROTECTED] wrote: [snip] > > import urllib > import urllib2 > import re > import MySQLdb > > conn=MySQLdb.connect > (host="localhost",user="root",passwd="ylj",db="net", charset="utf8") > cur = conn.cursor() > sql='select > net_site.downline_re,net_si

Re: return a value to shell script

2008-11-12 Thread Grant Edwards
On 2008-11-12, devi thapa <[EMAIL PROTECTED]> wrote: > I am executing a python script in a shell script. The python > script actually returns a value. So, can I get the return > value in a shell script? If yes, then help me out. There are two ways to "return" something to a shell script. 1) To

Re: return a value to shell script

2008-11-12 Thread Jeff McNeil
On Nov 12, 8:19 am, "D'Arcy J.M. Cain" <[EMAIL PROTECTED]> wrote: > On Wed, 12 Nov 2008 13:09:21 + > > Tom Wright <[EMAIL PROTECTED]> wrote: > > devi thapa wrote: > > > I am executing a python script in a shell script. The python script > > > actually returns a value. > > > So, can I get the r

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-12 Thread Grant Edwards
On 2008-11-12, Steve Holden <[EMAIL PROTECTED]> wrote: > greg wrote: I stopped paying much attention to this thread a while ago, but you've got to admire the persistence of somebody who soldiers on even though Aahz, Fredrik Lund, and Steve Holden are all on the other side of the argument... -- G

Adding a proxy

2008-11-12 Thread William.Tse
Hello, How do I add a proxy to an http request in Python ? These are the first few lines of my code : import xml import fpconst import SOAPpy from SOAPpy import WSDL wsdlFile = 'http://..com/webService.wsdl' server = WSDL.Proxy(wsdlFile) I have the IP that I'm suppose to use, but I don't

loading modules, metaclasses, chicken & eggs

2008-11-12 Thread sandro
Hi, I had two packages working fine toghether: debug and sqlkit. Debug provides a metaclass just for debuggging purposes to sqlkit (to log methods following a recipe on ASPN. It worked very well, just logging depending on the value of a module variable in debug module. That means module debug a

ANN: eGenix mxODBC Connect - Python Database Interface 0.9.3 (beta)

2008-11-12 Thread eGenix Team: M.-A. Lemburg
ANNOUNCING eGenix.com mxODBC Connect Python Database Interface Version 0.9.3 (beta) Our new client-server product for connecting Python applications

Re: [ANN] SQLkit 0.8.3.2

2008-11-12 Thread sandro
Thorsten Kampe wrote: >> >> I'm happy to announce release 0.8.3 of sqlkit package for python - the >> first public release. > > Are you aware that you announced "sqlite 0.8.3" in the subject??!! > Ops, I wasn't aware, just too tired... thanks for telling. Anyhow, since I had some problems i

Re: Problem with sqlite3 cursor and imbricated for loop

2008-11-12 Thread Gerhard Häring
Charles V. wrote: Hi, Both may be standard compliant, but if you're depending on implementation details, you may still get different behaviour. I'm pretty sure that MySQLdb always fetches the entire resultset from the server. The sqlite3 module uses what would have been called "server-side curs

Re: Problem with sqlite3 cursor and imbricated for loop

2008-11-12 Thread Gerhard Häring
Steve Holden wrote: [...] I feel with you. The fact that cursors, and not connection objects have the executeXXX methods is totally braindead. So you'd rather have to use separate connections? That would make isloated transaction processing a little tricky ... No, I just find code like: con

Re: duck-type-checking?

2008-11-12 Thread J Kenneth King
Joe Strout <[EMAIL PROTECTED]> writes: > Let me preface this by saying that I think I "get" the concept of > duck- > typing. > > However, I still want to sprinkle my code with assertions that, for > example, my parameters are what they're supposed to be -- too often I > mistakenly pass in somethi

Re: How can a function know what module it's in?

2008-11-12 Thread Joe Strout
On Nov 11, 2008, at 9:49 PM, Rafe wrote: I'm sure there is a magic identifier somewhere that lets a code get a reference to its own module, but I haven't been able to find it. import sys this_module = sys.modules[__name__] Beautiful! Thanks very much. For the archives, here is my standard

duck-type-checking?

2008-11-12 Thread Joe Strout
Let me preface this by saying that I think I "get" the concept of duck- typing. However, I still want to sprinkle my code with assertions that, for example, my parameters are what they're supposed to be -- too often I mistakenly pass in something I didn't intend, and when that happens, I w

Re: Problem with sqlite3 cursor and imbricated for loop

2008-11-12 Thread Charles V.
Hi, > Both may be standard compliant, but if you're depending on > implementation details, you may still get different behaviour. > I'm pretty sure that MySQLdb always fetches the entire resultset from > the server. The sqlite3 module uses what would have been called > "server-side cursors" in rea

Re: problem with JSON-RPC

2008-11-12 Thread Diez B. Roggisch
Michel Perez wrote: > Hi everybody: > I'm trying to use JSON-RPC to provide my services but produce this > exception: > > Traceback (most recent call last): > File "", line 1, in > File "jsonrpc/proxy.py", line 43, in __call__ > resp = loads(respdata) > File "jsonrpc/json.py", line 21

problem with JSON-RPC

2008-11-12 Thread Michel Perez
Hi everybody: I'm trying to use JSON-RPC to provide my services but produce this exception: Traceback (most recent call last): File "", line 1, in File "jsonrpc/proxy.py", line 43, in __call__ resp = loads(respdata) File "jsonrpc/json.py", line 211, in loads raise JSONDecodeExcepti

Re: sys.stdout, urllib and unicode... I don't understand.

2008-11-12 Thread Thierry
> Are you sure that Python wasn't just printing out "\n" because you'd > asked it to show you the repr() of a string containing newlines? Yes, I am sure. Because I dumped the ord() values to check them. But again, I'm stumped on how complicated I have made this. I should not try to code anymore at

Re: [Array] Finding index that contains part of a string?

2008-11-12 Thread Tim Chase
Out of curiosity, is there a better way in Python to iterate through an array, and return the index of each item that contains the bit somewhere in its value, ie. index() doesn't work because it only returns if the value only contains the item I'm looking for. This works: next = re.compi

[Array] Finding index that contains part of a string?

2008-11-12 Thread Gilles Ganault
Hello Out of curiosity, is there a better way in Python to iterate through an array, and return the index of each item that contains the bit somewhere in its value, ie. index() doesn't work because it only returns if the value only contains the item I'm looking for. This works: next = re

Re: Problem with sqlite3 cursor and imbricated for loop

2008-11-12 Thread Steve Holden
Gerhard Häring wrote: > Charles V. wrote: >> Hi, >> >> Thank for replying. >> >>> Either use a second cursor OR ensure you fetch all the data from the >>> first .execute() first: >> >> Are these really the only solutions ? > > Yes. > >> I was expecting the same behavior than MySQLdb module, whic

Re: return a value to shell script

2008-11-12 Thread rishi pathak
Look at os._exit() On Wed, Nov 12, 2008 at 6:36 PM, devi thapa <[EMAIL PROTECTED]> wrote: > Hi, > > I am executing a python script in a shell script. The python script > actually returns a value. > So, can I get the return value in a shell script? If yes, then help me out. > > Regards, > Devi >

Re: return a value to shell script

2008-11-12 Thread D'Arcy J.M. Cain
On Wed, 12 Nov 2008 13:09:21 + Tom Wright <[EMAIL PROTECTED]> wrote: > devi thapa wrote: > > I am executing a python script in a shell script. The python script > > actually returns a value. > > So, can I get the return value in a shell script? If yes, then help me > > out. > > Yes. The vari

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-12 Thread Francesco Guerrieri
On Wed, Nov 12, 2008 at 2:01 PM, Steve Holden <[EMAIL PROTECTED]> wrote: > Now, can we get on to something substantive like how many angels can > dance on the head of a pin? > Oh, come on, that's too easy! 42. I thought that by now everybody knew that. Francesco -- http://mail.python.org/mailman/

Re: return a value to shell script

2008-11-12 Thread Marco Bizzarri
On Wed, Nov 12, 2008 at 2:06 PM, devi thapa <[EMAIL PROTECTED]> wrote: > Hi, > > I am executing a python script in a shell script. The python script > actually returns a value. > So, can I get the return value in a shell script? If yes, then help me out. > > Regards, > Devi > -- > http://mail.pyth

Re: How can a function know what module it's in?

2008-11-12 Thread Steve Holden
Joe Strout wrote: > Some corrections, to highlight the depth of my confusion... > > On Nov 11, 2008, at 9:10 PM, Joe Strout wrote: > >> doctest.testmod(mymodule) >> >> This actually works fine if I'm importing the module (with the >> standard name) somewhere else > > Actually, it does not. >

Re: return a value to shell script

2008-11-12 Thread Tom Wright
devi thapa wrote: > I am executing a python script in a shell script. The python script > actually returns a value. > So, can I get the return value in a shell script? If yes, then help me > out. Yes. The variable $? should be bound to the return value of the last foreground program to exit. Th

credit kredite oesterreich ratenkredite online kredit ohne schufa in blitzkredite

2008-11-12 Thread [EMAIL PROTECTED]
credit kredite oesterreich ratenkredite online kredit ohne schufa in blitzkredite + + + + +++ GUENSTIGE KREDITE ONLINE +++ KREDITE IM INTERNET OHNE SCHUFA +++ + + http://www.usd.edu/phys/courses/astronomy/bord/messages/19924.html http://www.usd.edu/phys/courses/astronomy/bord/messages/19924.html h

return a value to shell script

2008-11-12 Thread devi thapa
Hi, I am executing a python script in a shell script. The python script actually returns a value. So, can I get the return value in a shell script? If yes, then help me out. Regards, Devi -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with sqlite3 cursor and imbricated for loop

2008-11-12 Thread Steve Holden
Charles V. wrote: > Hi, > > Thank for replying. > >> Either use a second cursor OR ensure you fetch all the data from the >> first .execute() first: > > Are these really the only solutions ? I was expecting the same behavior than > MySQLdb module, which is, as sqlite3, DB-API 2.0 compatible. >

Re: int() and leading zeros in Python 2.6

2008-11-12 Thread Pete Forman
Peter Otten <[EMAIL PROTECTED]> writes: > you're wrong. Indeed I am, sorry for the waste of time. -- Pete Forman-./\.- Disclaimer: This post is originated WesternGeco -./\.- by myself and does not represent [EMAIL PROTECTED]-./\.- the opinion of Schlumb

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-12 Thread Steve Holden
greg wrote: > Fredrik Lundh wrote: > >> It's not only misleading, it's also a seriously flawed reading of the >> original text - the Algol 60 report explicitly talks about assignment >> of *values*. > > Do you agree that an expression in Python has a value? > Most expressions have values. The on

Re: int() and leading zeros in Python 2.6

2008-11-12 Thread Peter Otten
Pete Forman wrote: > I'm holding off installing Python 2.6, waiting for some packages to > become available for it. I wonder if someone could tell me the best > way to avoid future problems parsing decimal integers with leading > zeros. You can have multiple versions of python simultaneously.

Re: Problem with sqlite3 cursor and imbricated for loop

2008-11-12 Thread Gerhard Häring
Charles V. wrote: Hi, Thank for replying. Either use a second cursor OR ensure you fetch all the data from the first .execute() first: Are these really the only solutions ? Yes. I was expecting the same behavior than MySQLdb module, which is, as sqlite3, DB-API 2.0 compatible. Both ma

  1   2   >