Re: Printing Barcodes from webapp?

2006-12-06 Thread Robin Becker
Dennis Lee Bieber wrote: > On Tue, 05 Dec 2006 18:19:58 GMT, Dennis Lee Bieber > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > >> Aye, just the Postnet scheme... The difficult part was working out >> the spacing for the dot-matrix printer; the rest was just using the >> Z

Re: how to get all the "variables" of a string formating?

2006-12-06 Thread Duncan Booth
"Calvin Spealman" <[EMAIL PROTECTED]> wrote: > I am not aware of anything in the stdlib to do this easily, but its > pretty easy to get them. See this example: > > class format_collector(object): >def __init__(self): > self.names = [] >def __getitem__(self, name): > self.names

RE: Async callback in python

2006-12-06 Thread Sells, Fred
the standard print gets "delayed" somewhere inside python, however if you use print >>sys.stderr, "whatever", 3, 4 5 that prints immediately, or so it seems to me. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Linan Sent: Monday, December 04, 2006 11:18 P

Re: how to get all the "variables" of a string formating?

2006-12-06 Thread Calvin Spealman
On 6 Dec 2006 18:33:26 GMT, Duncan Booth <[EMAIL PROTECTED]> wrote: > "Calvin Spealman" <[EMAIL PROTECTED]> wrote: > > > I am not aware of anything in the stdlib to do this easily, but its > > pretty easy to get them. See this example: > > > > class format_collector(object): > >def __init__(sel

Re: PyQt, designer, and directional flow

2006-12-06 Thread Phil Thompson
On Wednesday 06 December 2006 4:46 am, borntonetwork wrote: > I am creating a simple form using designer (qt4) on Ubuntu. I use pyuic > to create a python script from the form. I run the script and the form > shows up fine. The idiosyncrasy occurs when I try to type text into a > QTextEntry widget.

Re: No latin9 in Python?

2006-12-06 Thread Martin v. Löwis
Christoph Zwerschke schrieb: > Is there anything speaking against adding these as aliases? If no, I > would submit a patch. (Also, Python does not support the > latin10=iso8859-16 charset. I could try to add that as well.) Python tries to follow the IANA charset registry. http://www.iana.org/assi

Re: Getting started with the Python source

2006-12-06 Thread [EMAIL PROTECTED]
Actually IDLE was written purley in python, you can find the sources to it in... UNIX: /usr/lib/python/idlelib Windows: C:\Python\Lib\idlelib If you are looking to modifly mostly just the IDE I would start there, however if you are more interesting in modifying python Itself just look around in t

Re: how to get all the "variables" of a string formating?

2006-12-06 Thread [EMAIL PROTECTED]
"Is there an easy (i.e.: no regex) way to do get the names of all parameters? " ...regexp is the easy way :D GHUM wrote: > imagine: > > > template=""" Hello %(name)s, how are you %(action)s""" > > > we can use it to do things like: > > print template % dict (name="Guido", action="indenting") > >

Re: how to get all the "variables" of a string formating?

2006-12-06 Thread Tim Chase
>> Is there an easy (i.e.: no regex) way to do get the names of all >> parameters? >> >> get_parameters(template) should return ["name", "action"] > > How about: > > class gpHelper: > def __init__(self): > self.names = set() > def __getitem__(self, name): > self.names.add(n

Re: Getting started with the Python source

2006-12-06 Thread renguy
Thank you for your response. I guess I was looking for a more specific answer. I have the source and I have been looking around at the various code. I think my question is, what is the name of the toplevel source code file of C code for the Python interpreter, and what is the name of the toplevel s

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread [EMAIL PROTECTED]
The reason why it won't raise the AssertionError is because the condition in the assert statement is a non-empty tuple, and its boolean value would be True, not False, which is required to raise an assertion error. antred wrote: > Yeah, it hit me seconds after I had posted my message. =0 Why didn'

Re: What are python closures realy like?

2006-12-06 Thread Klaas
Michele Simionato wrote: > I believe decorators are in large part responsible for that. A callable > object does not work > as a method unless you define a custom __get__, so in decorator > programming it is > often easier to use a closure. OTOH closures a not optimal if you want > persistency >

Re: Getting started with the Python source

2006-12-06 Thread [EMAIL PROTECTED]
Right, I am pretty sure that the "toplevel" source of idle is in dir-to-pylibs/idlelib/idle.py (or maybe .pyw) that is were all the glue code is for idle, as for the python source, I haven't messed around with it too much so I couldn' tell you, well just have to wait for somone else to post that in

Re: Getting started with the Python source

2006-12-06 Thread Fredrik Lundh
renguy wrote: > Thank you for your response. I guess I was looking for a more specific > answer. I have the source and I have been looking around at the various > code. I think my question is, what is the name of the toplevel source > code file of C code for the Python interpreter, and what is the

Re: Async callback in python

2006-12-06 Thread Chris Mellon
On 12/4/06, Calvin Spealman <[EMAIL PROTECTED]> wrote: > On 4 Dec 2006 20:18:22 -0800, Linan <[EMAIL PROTECTED]> wrote: > > Hi, > > > > In javascript, code could be written like this: > > > > ... > > > > var _p=XMLHttpRequest(); > > _p.open('GET',url,true); > > _p.send(null)

Re: List of Events in wxPython

2006-12-06 Thread hg
Jacksondf wrote: > What is that procedure for determining which events can be binded for a > particular widget? The docs don't seem to help. For example, how can I > know which events wx.SpinButton will send. > > Thanks. from the doc: To process input from a spin button, use one of these event

newb: Can I use PYRO

2006-12-06 Thread johnny
What I want to do is the following: Web user uploads a word doc (web app written in php), and I need it to move the uploaded word doc, on to another machine and conver it to pdf. Then update the database and allow immediate pdf download. I am thinking of using ftp from machine 1 -> machine 2, th

I'm looking to learn pyqt

2006-12-06 Thread vj
Is there a a tutorial or a sample application I can start with (that works with qt4 and pyqt4)? Thanks, VJ -- http://mail.python.org/mailman/listinfo/python-list

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread Terry Reedy
"antred" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Yeah, it hit me seconds after I had posted my message. =0 Why didn't I > think of it during the 30 minutes I spent banging my head against the > keyboard going nuts over this 'bug' ... Because communication brings consciousne

Re: newb: Can I use PYRO

2006-12-06 Thread Irmen de Jong
johnny wrote: > What I want to do is the following: > > Web user uploads a word doc (web app written in php), and I need it to > move the uploaded word > doc, on to another machine and conver it to pdf. Then update the > database and allow immediate pdf download. I am thinking of using ftp > fro

Re: Video stream server

2006-12-06 Thread Fredrik Lundh
Lad wrote: > I love Python so I would like to implement video support in Python. maybe this might be helpful? http://blog.go4teams.com/archives/video-blogging-using-django-and-flashtm-video-flv/56 -- http://mail.python.org/mailman/listinfo/python-list

Mirror imaging binary numbers

2006-12-06 Thread Craig
Hi there, I'm trying to switch binary numbers around so that the MSB becomes the LSB etc. Is there an easy way of doing this as I can't seem to find anything. If you could help that would be great. Thanks and good luck. Craig -- http://mail.python.org/mailman/listinfo/python-list

advice on stripped down python

2006-12-06 Thread fhaibach
I'm looking for advice on a stripped down Python for an SBC to run Numpy and Scipy. I have the following notes on the system We have code that requires recent versions of Numpy and Scipy. The processor is a Sharp ARM LH7A404 with 32MB of SDRAM. 512 MB flash disk - but 400 MB is reserved for data

Re: advice on stripped down python

2006-12-06 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Will old Python releases, like 1.5.x, work with newer Numpy and Scipy? No. numpy and scipy require 2.3. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though

[Python] SMTP server based on Python?

2006-12-06 Thread Peter Smith [gjfc]
People, I have sendmail working on my linux box. Since I can use sendmail to send e-mails, would it be easy to write a simple Python class which listens for data on port 25? Then, if it gets some data, it just passes it to sendmail. Do any of you know if such a simple script is floating around

Re: I'm looking to learn pyqt

2006-12-06 Thread David Boddie
vj wrote: > Is there a a tutorial or a sample application I can start with (that > works with qt4 and pyqt4)? PyQt4 is distributed with a set of small examples, mostly ported from the C++ ones supplied with Qt. Other than those, you could take a look at the PyQt and PyKDE Wiki for inspiration:

Re: [Python] SMTP server based on Python?

2006-12-06 Thread Fredrik Lundh
Peter Smith [gjfc] wrote: > I have sendmail working on my linux box. > > Since I can use sendmail to send e-mails, would it be easy to write a > simple Python class which listens for data on port 25? > > Then, if it gets some data, it just passes it to sendmail. > > Do any of you know if such a

Where does a class closure live?

2006-12-06 Thread Gerard Brunick
Consider: ### Function closure example def outer(s): ... def inner(): ... print s ... return inner ... >>> f = outer(5) >>> f() 5 >>> dir(f) ['__call__', '__class__', '__delattr__', '__dict__', '__doc__', '__get__', '__getattribute__', '__hash__', '__init__', '__module__', '

Re: len() and PEP 3000

2006-12-06 Thread Beliavsky
Thomas Guettler wrote: > Hi, > > The function len() is not mentioned in the Python 3000 PEPs. > > I suggest that at least lists, tupples, sets, dictionaries and strings > get a len() method. I think the len function can stay, removing it > would break to much code. But adding the method, would bu u

Beautiful Soup : Problem extracting links

2006-12-06 Thread Shitiz Bansal
Hi, I am using beautiful soup to get links from an html document. I found that beautiful Soup changes the & in the links to & due to which some of the links become unusable. Is there any way I could stop this behaviour? Regards, Shitiz __ Do You

Re: About the 79 character line recommendation

2006-12-06 Thread Ramon Diaz-Uriarte
On 5 Dec 2006 13:28:22 -0800, Steve Bergman <[EMAIL PROTECTED]> wrote: (...) > > I'm finding 100 to be a nice balance. It forces me not to be lazy and > allow really long lines, but allows me to format so as to make the > meaning most clear. > But if you use some advanced editors (such as Emac

Re: Mod_python vs. application server like CherryPy?

2006-12-06 Thread Vincent Delporte
On 5 Dec 2006 17:05:06 -0800, "fumanchu" <[EMAIL PROTECTED]> wrote: >In a nutshell, mod_python gives you >access from Python to the Apache API, whereas CherryPy and friends give >you their own API. I didn't know Apache had an API of its own, or that it was even needed when writing a web applicatio

Re: Video stream server

2006-12-06 Thread Paul Boddie
Lad wrote: > > I love Python so I would like to implement video support in Python. > That is how it is related to Python only I'm not sure if this is too low-level, but there's always the Flumotion platform [1]: an open source streaming solution based on Python, GStreamer and Twisted, and there's

Re: len() and PEP 3000

2006-12-06 Thread Klaas
Beliavsky wrote: > Thomas Guettler wrote: > > Hi, > > > > The function len() is not mentioned in the Python 3000 PEPs. > > > > I suggest that at least lists, tupples, sets, dictionaries and strings > > get a len() method. I think the len function can stay, removing it > > would break to much code.

Windows installer for Scientific Python for Python 2.4?

2006-12-06 Thread Grant Edwards
Can anybody point me to a windows installer for scientific python that will work with Python 2.4? The Scientific python download page only has an installer for Python 2.3. -- Grant Edwards grante Yow! Yow! I like my new at

Re: SPE (Stani's Python Editor) web site?

2006-12-06 Thread John DeRosa
On 4 Dec 2006 17:06:40 -0800, "Bernard" <[EMAIL PROTECTED]> wrote: >yes sir should I send them to you? Thanks, but no. After I replied to you, I heard from Stani. The "Python 2.4" image will work just fine on 2.5. And I've done exactly that, and it runs great. Thanks anyway! John > >John De

Re: len() and PEP 3000

2006-12-06 Thread Fredrik Lundh
Beliavsky wrote: > I agree with you -- a.__len__() is ugly compared to len(a) . I am > surprised that such common idioms as len(a) may be going away. no need to; the fact that something isn't currently mentioned in a preliminary Python 3000 PEP doesn't mean that it will be removed. -- http:/

Re: Mirror imaging binary numbers

2006-12-06 Thread Matimus
Craig wrote: > I'm trying to switch binary numbers around so that the MSB becomes the > LSB etc. What do you mean 'binary numbers'? They are all binary. If you mean the int type, they are 32 bits long and there are 16 bits between the MSB and LSB (Most/Least Significant _Byte_). Do you want to swa

Re: Mod_python vs. application server like CherryPy?

2006-12-06 Thread Paul Boddie
Vincent Delporte wrote: > On 5 Dec 2006 17:05:06 -0800, "fumanchu" <[EMAIL PROTECTED]> wrote: > >In a nutshell, mod_python gives you > >access from Python to the Apache API, whereas CherryPy and friends give > >you their own API. > > I didn't know Apache had an API of its own, or that it was even n

Re: Mod_python vs. application server like CherryPy?

2006-12-06 Thread Graham Dumpleton
Vincent Delporte wrote: > On 5 Dec 2006 17:05:06 -0800, "fumanchu" <[EMAIL PROTECTED]> wrote: > >In a nutshell, mod_python gives you > >access from Python to the Apache API, whereas CherryPy and friends give > >you their own API. > > I didn't know Apache had an API of its own, or that it was even

Module Indexing

2006-12-06 Thread JKPeck
We are interested in building a module index for our libraries similar to the global module index on the Python site. Is there a tool/script available that builds something similar to that automatically? We would probably want the result to be an html document. TIA, Jon Peck -- http://mail.pyt

Re: Mirror imaging binary numbers

2006-12-06 Thread Craig
Matimus wrote: > Craig wrote: > > I'm trying to switch binary numbers around so that the MSB becomes the > > LSB etc. > > What do you mean 'binary numbers'? They are all binary. If you mean the > int type, they are 32 bits long and there are 16 bits between the MSB > and LSB (Most/Least Significa

Re: Module Indexing

2006-12-06 Thread Diez B. Roggisch
JKPeck schrieb: > We are interested in building a module index for our libraries similar > to the global module index on the Python site. Is there a tool/script > available that builds something similar to that automatically? We > would probably want the result to be an html document. Several, e

SOAPpy - Getting info about the __init__ method

2006-12-06 Thread Steve
Hi All, I have a Python script that uses SOAPpy and I'm outputting all of the methods and info about the parameters... I'm having trouble getting information out of the __init__ parameter. My code : from SOAPpy import WSDL def GetWebServicesMethods(url): # requires import : #from SOAPpy impor

Re: Mirror imaging binary numbers

2006-12-06 Thread Grant Edwards
On 2006-12-06, Craig <[EMAIL PROTECTED]> wrote: > Thanks so much for the response. I have an array of > individual bytes which will eventually make up a binary bitmap > image that is loaded onto an LCD screen (1 = black dot, 0 = > white dot). At the moment each byte is reversed to what it > shou

True Division in Python

2006-12-06 Thread kermit
For a long time,, There has been a discussion of trueFor division versus integer division in Python. I myslef prefer that / be used for integer division since almost always, I want the result of the division be truncated to integer. However, today I reviewed the method to be used in Python t

Re: Mirror imaging binary numbers

2006-12-06 Thread [EMAIL PROTECTED]
Craig wrote: > Matimus wrote: > > > Craig wrote: > > > I'm trying to switch binary numbers around so that the MSB becomes the > > > LSB etc. > > > > What do you mean 'binary numbers'? They are all binary. If you mean the > > int type, they are 32 bits long and there are 16 bits between the MSB > >

Re: Mirror imaging binary numbers

2006-12-06 Thread dickinsm
On Dec 6, 6:01 pm, "Craig" <[EMAIL PROTECTED]> wrote: > Thanks so much for the response. I have an array of individual bytes > which will eventually make up a binary bitmap image that is loaded onto > an LCD screen (1 = black dot, 0 = white dot). At the moment each byte > is reversed to what it s

Re: True Division in Python

2006-12-06 Thread Olexandr Melnyk
6 Dec 2006 15:41:04 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: However, today I reviewed the method to be used in Python to get true division, and this gave me an idea how true division could be implemented without interferring with the use of / for integer division. Use / for integer div

Re: Windows installer for Scientific Python for Python 2.4?

2006-12-06 Thread hrh1818
How did you come to your conclusion? The scipy page at http://www.scipy.org/Download shows the following: "Install SciPy 0.5.1 for Python 2.4 or SciPy 0.5.1 for Python 2.3" Howard Grant Edwards wrote: > Can anybody point me to a windows installer for scientific > python that will work with Pyth

Problem of understanding inheritance

2006-12-06 Thread matilda matilda
Hi all, I searched for a while, but didn't found answer to my question. I wrote the following little program: #!/usr/bin/python import datetime as dt class MyClass(dt.date): def __init__(self, *args, **kwargs): super(MyClass, self).__init__(*args,

Re: Mod_python vs. application server like CherryPy?

2006-12-06 Thread Vincent Delporte
On 6 Dec 2006 14:55:58 -0800, "Graham Dumpleton" <[EMAIL PROTECTED]> wrote: >Although WSGI is an extreme case because of the level it pitches at, >other systems such as CherryPy and Django aren't much different as they >effectively duplicate a lot of stuff that could be achieved using more >basic f

newb: How to call one modue from other

2006-12-06 Thread johnny
I have a module called ftp and I have another module called processKick. What I need is to have processKick, create fork and execute ftp like below. Relevant processKick code as follows: def do_child_stuff(): ftp def fork_test(): pid = os.fork() if pid == 0: # child

Re: SPE (Stani's Python Editor) web site?

2006-12-06 Thread dimitri pater
Hi, You would do me and other gurus a great favour if you put it on a server somewhere. I can put it on my server (serpia.org) if you want to, just email it to me and you can download it from serpia.org/spe --- You can't have everything. Where would you put it? -- Steven Wright --- please vi

Re: Windows installer for Scientific Python for Python 2.4?

2006-12-06 Thread Robert Kern
hrh1818 wrote: > How did you come to your conclusion? The scipy page at > http://www.scipy.org/Download shows the following: > "Install SciPy 0.5.1 for Python 2.4 or SciPy 0.5.1 for Python 2.3" ScientificPython != scipy http://dirac.cnrs-orleans.fr/ScientificPython/ http://sourcesup.cru.fr/proj

Re: Mirror imaging binary numbers

2006-12-06 Thread Grant Edwards
On 2006-12-06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Yet another solution: > > def flipbits(x): > """reverse bits in a byte""" > x1 = x << 4 | x >> 4 > x2 = (x1 & 51) << 2 | (x1 & 204) >> 2 > return (x2 & 85) << 1 | (x2 & 170) >> 1 > > The idea is to first swap the two nyb

Re: Problem of understanding inheritance

2006-12-06 Thread Robert Kern
matilda matilda wrote: > Hi all, > > I searched for a while, but didn't found answer to my question. > > I wrote the following little program: > > #!/usr/bin/python > import datetime as dt > class MyClass(dt.date): > def __init__(self, *args, **kwargs): >

Re: Mirror imaging binary numbers

2006-12-06 Thread dickinsm
On Dec 6, 7:20 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > It's a little less obtuse if you spell it this way: > > def flipbits(x): > """reverse bits in a byte""" > x1 = x << 4 | x >> 4 > x2 = (x1 & 0x33) << 2 | (x1 & 0xcc) >> 2 > return (x2 & 0x55) << 1 | (x2 & 0xaa) >> 1 > G

Re: Mod_python vs. application server like CherryPy?

2006-12-06 Thread Graham Dumpleton
Vincent Delporte wrote: > On 6 Dec 2006 14:55:58 -0800, "Graham Dumpleton" > <[EMAIL PROTECTED]> wrote: > >Although WSGI is an extreme case because of the level it pitches at, > >other systems such as CherryPy and Django aren't much different as they > >effectively duplicate a lot of stuff that co

how to convert a function into generator?

2006-12-06 Thread Schüle Daniel
Hello, I came up with this algorithm to generate all permutations it's not the best one, but it's easy enough # lst = list with objects def permute3(lst): tmp = [] lenlst = len(lst) def permute(perm, level): if level == 1: tmp.append(perm) return

Re: True Division in Python

2006-12-06 Thread Kleine Aap
[EMAIL PROTECTED] wrote: > Use ./ for true division. syntax error... -- http://mail.python.org/mailman/listinfo/python-list

Re: Mirror imaging binary numbers

2006-12-06 Thread Terry Reedy
"Craig" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thanks so much for the response. I have an array of individual bytes > which will eventually make up a binary bitmap image that is loaded onto > an LCD screen (1 = black dot, 0 = white dot). At the moment each byte > is rever

Re: newb: Join two string variables

2006-12-06 Thread true911
johnny wrote: > How do I join two string variables? > I want to do: download_dir + filename. > download_dir=r'c:/download/' > filename =r'log.txt' > > I want to get something like this: > c:/download/log.txt pathfn = download_dir+filename -- http://mail.python.org/mailman/listinfo/python-list

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread Gabriel Genellina
At Wednesday 6/12/2006 11:46, antred wrote: Yeah, it hit me seconds after I had posted my message. =0 Why didn't I think of it during the 30 minutes I spent banging my head against the keyboard going nuts over this 'bug' ... The same reason you can sometimes find what's wrong just by explaini

Re: newb: How to call one modue from other

2006-12-06 Thread johnny
johnny wrote: > I have a module called ftp and I have another module called > processKick. What I need is to have processKick, create fork and > execute ftp like below. > > Relevant processKick code as follows: > > def do_child_stuff(): > ftp > > def fork_test(): > pid = os.fork() > if

Re: Mirror imaging binary numbers

2006-12-06 Thread Craig
Terry Reedy wrote: > "Craig" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Thanks so much for the response. I have an array of individual bytes > > which will eventually make up a binary bitmap image that is loaded onto > > an LCD screen (1 = black dot, 0 = white dot). At th

Re: Where does a class closure live?

2006-12-06 Thread Terry Reedy
"Gerard Brunick" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Consider: > > ### Function closure example > > def outer(s): > ... def inner(): > ... print s > ... return inner > ... > >>> f = outer(5) > >>> f() > 5 > >>> dir(f) > ['__call__', '__class__', '__delat

per instance descriptors

2006-12-06 Thread Simon Bunker
Hi I have code similar to this: class Input(object): def __init__(self, val): self.value = val def __get__(self, obj, objtype): return self.value def __set__(self, obj, val): # do some checking... only accept floats etc self.value = val class

Re: True Division in Python

2006-12-06 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > For a long time,, There has been a discussion of trueFor division > versus integer division in Python. The discussion and the decision to use // and / were years ago. > I myslef prefer that / be used for integer division since al

Re: dict.has_key(x) versus 'x in dict'

2006-12-06 Thread skip
Peter> Bjoern Schliessmann wrote: >> Wouldn't be "if k in d.keys()" be the exact replacement? Peter> No, 'k in d' is equivalent to 'd.has_key(k)', only with less Peter> (constant) overhead for the function call. 'k in d.keys()' on the Peter> other hand creates a list of keys w

Re: PyRun_SimpleString no sys.argv[0]

2006-12-06 Thread Gabriel Genellina
At Wednesday 6/12/2006 12:23, iwl wrote: I'm just starting with Python - would like to embed it in my windows-programm as an script-processor. For tests I use easygui some easy-wrapper for the py-tck-stuff. Looks a bit strange for me. If the GUI will be in Python, I think you could do things

Re: Best memory analyzer?

2006-12-06 Thread skip
Hugo> I'm using the BGL bindings, but I think I'm having a giant memory Hugo> leak. Thing is, I'm not sure if it is the bound C++ variables that Hugo> are not being trashed, or if the leak is inside my program. You didn't say what platform you use, but if you're on Linux you should lo

newb: What is the purpose of if __name__ == "__main__":

2006-12-06 Thread johnny
What is the purpose of if __name__ == "__main__": If you have a module, does it get called automatically? -- http://mail.python.org/mailman/listinfo/python-list

Re: extension programing with c

2006-12-06 Thread Gabriel Genellina
At Wednesday 6/12/2006 13:41, mahdieh saeed wrote: I want to define extention module that connect to berkeley db. You know support for Berkeley DB comes with the standard library, don't you? Look at the bsddb module. -

Re: newb: What is the purpose of if __name__ == "__main__":

2006-12-06 Thread Robert Kern
johnny wrote: > What is the purpose of > if __name__ == "__main__": > > If you have a module, does it get called automatically? http://docs.python.org/lib/module-main.html -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our

Re: PHP calls python: process vs threads

2006-12-06 Thread Gabriel Genellina
At Wednesday 6/12/2006 13:54, johnny wrote: What I want to do is the following: Web user uploads a word doc, and I need it to move the uploaded word doc, on to another machine and conver it to pdf. Then update the database and allow immediate pdf download. I am thinking of using ftp from mach

Re: newb: What is the purpose of if __name__ == "__main__":

2006-12-06 Thread Soni Bergraj
johnny wrote: > What is the purpose of > if __name__ == "__main__": > > If you have a module, does it get called automatically? > It is a common pattern to make one and the same source file usable as a program and as a module. When you import some python module its __name__ is never "__main__".

Re: newb: What is the purpose of if __name__ == "__main__":

2006-12-06 Thread Ben Finney
"johnny" <[EMAIL PROTECTED]> writes: > What is the purpose of > if __name__ == "__main__": http://www.python.org/infogami-faq/tutor/tutor-what-is-if-name-main-for/> -- \ "He that would make his own liberty secure must guard even his | `\ enemy from oppressi

Re: how to convert a function into generator?

2006-12-06 Thread Carsten Haese
On Wed, 2006-12-06 at 17:33 +0100, Schüle Daniel wrote: > def permute3gen(lst): > lenlst = len(lst) > def permute(perm, level): > if level == 1: > yield perm > return # not sure return without a value is allowed, > theoretically it could be replaces w

Need Help Parsing From File

2006-12-06 Thread John Frame
Hi, I've got a Python program that I'm trying to edit, and I need some help. If I would like to read a matrix from a previously created text file into a two dimensional array, how would I do that? Like, if in the txt file, I had the following matrix formatted numbers with 5 rows and 10 columns

Re: Coding standards without control?

2006-12-06 Thread Soni Bergraj
>> Python makes coding standards obsolete;) > But Python has the advantage, that your coding standards can concentrate on > the important things and skip most of the formatting rules, that are often > part of other languages coding standards. Better to say, almost obsolete, i guess :D -- Soni Be

Re: newb: How to call one modue from other

2006-12-06 Thread Gabriel Genellina
At Wednesday 6/12/2006 23:20, johnny wrote: Can someone also tell me what is the purpose of if __name__ == "__main__": Reading the Python Tutorial helps a lot. Do I have to call, main of ftp module within processKick? Yes, because the original script author didn't want to call a function

Re: Mod_python vs. application server like CherryPy?

2006-12-06 Thread Vincent Delporte
On 6 Dec 2006 16:32:14 -0800, "Graham Dumpleton" <[EMAIL PROTECTED]> wrote: >Getting perhaps back to the answer you were seeking right back at the >start, that is if you are new to web application and development and >Python, then you may well be better of just using a higher level >framework as th

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread Neil Cerutti
On 2006-12-07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: >>Yeah, it hit me seconds after I had posted my message. =0 Why >>didn't I think of it during the 30 minutes I spent banging my >>head against the keyboard going nuts over this 'bug' ... > > The same reason you can sometimes find what's wr

Re: Need Help Parsing From File

2006-12-06 Thread Soni Bergraj
John Frame wrote: > How would I read this data from the file into a two dimensional array in > Python? Like: [x.split() for x in open('myfile.txt')] Or if you need integers: [[int(a) for a in x.split()] for x in open('myfile.txt')] ;) -- Soni Bergraj http://www.YouJoy.org/ -- http://mail.pyth

Re: Need Help Parsing From File

2006-12-06 Thread Gabriel Genellina
At Thursday 7/12/2006 00:20, John Frame wrote: Like, if in the txt file, I had the following matrix formatted numbers with 5 rows and 10 columns, and each number is separated by a single space: 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44

Re: newb: How to call one modue from other

2006-12-06 Thread johnny
Gabriel Genellina wrote: > Reading the Python Tutorial helps a lot. > I did read "Dive Into Python", one week ago. It's a good book, but it didn't cover this kind of situation. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why not just show the out-of-range index?

2006-12-06 Thread OKB (not okblacke)
John Machin wrote: > Firstly, you may say that you want to look only at the ONE that is > actually bound to THE incorrect value, but the interpreter has in > general no way of telling which one is bad. For example: > > foo = "a" > bar = [1] > baz= "z" > goo = [26] > x = foo + bar > > This causes:

Re: newb: How to call one modue from other

2006-12-06 Thread Ben Finney
"johnny" <[EMAIL PROTECTED]> writes: > Gabriel Genellina wrote: > > > Reading the Python Tutorial helps a lot. > > > I did read "Dive Into Python", one week ago. It's a good book, but > it didn't cover this kind of situation. Yes, it is good. It's also not the Python tutorial. The Python tutori

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread Ben Finney
Neil Cerutti <[EMAIL PROTECTED]> writes: > On 2006-12-07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > The same reason you can sometimes find what's wrong just by > > explaining the symptoms to another guy... Having to put things > > sorted and simple to understand by another, just makes you t

Re: Windows installer for Scientific Python for Python 2.4?

2006-12-06 Thread hrh1818
How right you are. Thanks for the correctikon, Howard Robert Kern wrote: > hrh1818 wrote: > > How did you come to your conclusion? The scipy page at > > http://www.scipy.org/Download shows the following: > > "Install SciPy 0.5.1 for Python 2.4 or SciPy 0.5.1 for Python 2.3" > > ScientificPython

Liboobs for python

2006-12-06 Thread Peerumporn Jiranantanagorn
Dear All, Is there any python module that work like liboobs or use to ease programming tasks like gnome-system-tools ? Thank you Orca _ Stay up-to-date with your friends through the Windows Live Spaces friends list. http://cl

Re: newb: How to call one modue from other

2006-12-06 Thread Gabriel Genellina
At Thursday 7/12/2006 01:03, johnny wrote: Gabriel Genellina wrote: > Reading the Python Tutorial helps a lot. > I did read "Dive Into Python", one week ago. It's a good book, but it didn't cover this kind of situation. Chapter 2. "Your First Python Program" The *very*first* example does thi

Re: per instance descriptors

2006-12-06 Thread George Sakkis
Simon Bunker wrote: > Hi I have code similar to this: > > class Input(object): > > def __init__(self, val): > self.value = val > > def __get__(self, obj, objtype): > return self.value > > def __set__(self, obj, val): > # do some checking... only accept flo

Re: Why not just show the out-of-range index?

2006-12-06 Thread Gabriel Genellina
At Thursday 7/12/2006 01:17, OKB (not okblacke) wrote: So my conclusion from this is: is there a reason that every error message of the form "expected foo" or "this object cannot be frotzed" cannot be changed to something like "expected foo but found bar" or "this FooType object cannot

Weekly Python Patch/Bug Summary

2006-12-06 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 413 open ( +6) / 3489 closed ( +5) / 3902 total (+11) Bugs: 943 open ( +7) / 6364 closed ( +1) / 7307 total ( +8) RFE : 246 open ( +0) / 244 closed ( +0) / 490 total ( +0) New / Reopened Patches __ popen() s

differences between ubuntu and fedora python

2006-12-06 Thread Eric S. Johansson
fedora [EMAIL PROTECTED] ~]# file /etc/postfix/transport* /etc/postfix/transport:ASCII English text /etc/postfix/transport.db: Berkeley DB (Hash, version 8, native byte-order) # python /usr/lib/python2.4/whichdb.py /etc/postfix/transport UNKNOWN /etc/postfix/transport # python /usr/l

Re: per instance descriptors

2006-12-06 Thread Gabriel Genellina
At Thursday 7/12/2006 01:58, George Sakkis wrote: Simon Bunker wrote: > Basically I want to have the Input class as a gateway that does lots of > checking when the attibute is assigned or read. > > I have had a look at __getattribute__(), but this gets very ugly as I > have to check if the attr

Re: Mod_python vs. application server like CherryPy?

2006-12-06 Thread fumanchu
Graham Dumpleton wrote: > For example, consider an extreme case such as WSGI. > Through a goal of WSGI being portability it effectively > ignores practically everything that Apache has to offer. > Thus although Apache offers support for authentication > and authorisation, a WSGI user would have to

Re: per instance descriptors

2006-12-06 Thread Carl Banks
Simon Bunker wrote: > Hi I have code similar to this: > > class Input(object): > > def __init__(self, val): > self.value = val > > def __get__(self, obj, objtype): > return self.value > > def __set__(self, obj, val): > # do some checking... only accept flo

<    1   2   3   >