Re: Magic function

2008-01-15 Thread Ruediger
[EMAIL PROTECTED] wrote: > Hi Rüdiger, > > Thanks for your message. I liked your approach and I've been trying > something along exactly these sorts of lines, but I have a few > problems and queries. > > The first problem is that the id of the frame object can be re-used, > so for example this

Re: searching an XML doc

2008-01-15 Thread Diez B. Roggisch
Gowri schrieb: > Hello, > > I've been reading about ElementTreee and ElementPath so I could use > them to find the right elements in the DOM. Unfortunately neither of > these seem to offer XPath like capabilities where I can find elements > based on tag, attribute values etc. Are there any librari

Re: Why this apparent assymetry in set operations?

2008-01-15 Thread John Machin
On Jan 16, 3:25 am, "Colin J. Williams" <[EMAIL PROTECTED]> wrote: Colin W. > > I'm sorry, there appears to be a bug: There is, but but not where you think it is :-) > # tSet.py > import sets [not the bug] Earlier evidence is that you are using 2.5.1; why import sets?? > s1= sets.Set([1, 2, 3]

Re: __init__ explanation please

2008-01-15 Thread Lie
I've been in this Python mailing list for a few days, and I've noticed several things here: There are too many fundamentalist! Don't play stupid and all, don't be a fundamentalist. It might be true that __init__ isn't a constructor and __new__ might be the constructor (some people even claimed __n

Re: "env" parameter to "popen" won't accept Unicode on Windows -minor Unicode bug

2008-01-15 Thread Bjoern Schliessmann
John Nagle wrote: > The problem is that only the NT-derived Microsoft systems > talk Unicode. The DOS/Win16/Win9x family did not. But they did > have CreateProcess. So the current code will handle Win9x, but not > Unicode. Please explain, I don't understand. If you try using Windows system functio

RE: __init__ explanation please

2008-01-15 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Lie > Sent: Tuesday, January 15, 2008 5:03 PM > To: python-list@python.org > Subject: Re: __init__ explanation please > > I've been in this Python mailing list for a few days, and I've noticed >

Re: dbus-python for windows

2008-01-15 Thread Suraj Barkale
est gmail.com> writes: > I am trying to port Scribes to Windows, Hi there like minded fellow > sourceforge.net/projects/windbus/≥ but it not for Python, so how could > I install dbus module for Windows Python 2.5 ? I have also started to dabble in windbus-python for the sake of Scribes. I have

Re: Restart crashing modules in windows

2008-01-15 Thread Astan Chee
Mike Driscoll wrote: On Jan 14, 9:02 pm, Astan Chee <[EMAIL PROTECTED]> wrote: Hi, I have a python module that keeps on crashing with various windows errors (not BSOD but the less lethal windows XP popup ones). Now these are intentional and rather sporadic so I cant really solve it by attempt

Re: Data mapper - need to map an dictionary of values to a model

2008-01-15 Thread George Sakkis
On Jan 14, 7:56 pm, Luke <[EMAIL PROTECTED]> wrote: > I am writing an order management console. I need to create an import > system that is easy to extend. For now, I want to accept an dictionary > of values and map them to my data model. The thing is, I need to do > things to certain columns: > >

Re: Data mapper - need to map an dictionary of values to a model

2008-01-15 Thread George Sakkis
On Jan 15, 6:53 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > name_tranformer = lambda input: dict( >zip(('first_name', 'last_name'), >input['name'])) Of course that should write: name_tranformer = lambda input: dict(

Re: Data mapper - need to map an dictionary of values to a model

2008-01-15 Thread Luke
On Jan 15, 3:53 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On Jan 14, 7:56 pm, Luke <[EMAIL PROTECTED]> wrote: > > > > > I am writing an order management console. I need to create an import > > system that is easy to extend. For now, I want to accept an dictionary > > of values and map them to

Memory problem with threading

2008-01-15 Thread [EMAIL PROTECTED]
Hi! I made a string parser program, it has a main function and a working thread class. When it is running in 24h non-stop, the memory run out. I dont Know why. Do anybody know somekind of debugger that can i see what is eating the memory? Maybe there is a list or value or dictionary that is growin

Re: searching an XML doc

2008-01-15 Thread Gowri
On Jan 15, 3:49 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Gowri schrieb: > > > Hello, > > > I've been reading about ElementTreee and ElementPath so I could use > > them to find the right elements in the DOM. Unfortunately neither of > > these seem to offer XPath like capabilities where I

Re: __init__ explanation please

2008-01-15 Thread Steven D'Aprano
On Tue, 15 Jan 2008 14:02:43 -0800, Lie wrote: > I've been in this Python mailing list for a few days, and I've noticed > several things here: There are too many fundamentalist! > > Don't play stupid and all, don't be a fundamentalist. It might be true > that __init__ isn't a constructor and __ne

Re: Python too slow?

2008-01-15 Thread Jaimy Azle
"Paul Boddie" <[EMAIL PROTECTED]> wrote: >> >> perhaps in the future another sillly point could be added also, Java has >> Jython, while Python doesn't have some thing like PyJava or... perhaps >> Py-va >> (Python based Java Language). > > You could compile Java to CPython bytecode or, in the case

login to https (newbie)

2008-01-15 Thread bkamrani
Hi Python gurus! Please help me how I can login to this page: https://www.boplats.se/user/login_hs.aspx?ReturnUrl=/HSS/Default.aspx I tried these two codes, but I don't seem to be successfull at all. (Both gave same result.) Many many thanks, /Ben --- import urllib2,urllib,cookielib url

Is str/unicode.encode supposed to work? with replace/ignore

2008-01-15 Thread BerlinBrown
With this code, ignore/replace still generate an error # Encode to simple ascii format. field.full_content = field.full_content.encode('ascii', 'replace') Error: [0/1] 'ascii' codec can't decode byte 0xe2 in position 14317: ordinal not in ran ge(1

Re: print >> to a derived file

2008-01-15 Thread Scott David Daniels
iu2 wrote: > Hi, > > I'm trying to write data to both a file and the console, so I did: > > class File_and_console(file): > def write(self, s): > file.write(self, s) > print s, f = File_and_console('1.txt', 'w') ... Always use the same method for writing,

error/warning color customization in interactive console?

2008-01-15 Thread yhvh
Is it possible to output error messages in a different color? I'm using Terminal on Gnome. -- http://mail.python.org/mailman/listinfo/python-list

Re: Restart crashing modules in windows

2008-01-15 Thread Mike Driscoll
On Jan 15, 2008 5:08 PM, Astan Chee <[EMAIL PROTECTED]> wrote: > > Mike Driscoll wrote: > On Jan 14, 9:02 pm, Astan Chee <[EMAIL PROTECTED]> wrote: > > > Hi, > I have a python module that keeps on crashing with various windows > errors (not BSOD but the less lethal windows XP popup ones). Now th

no pass-values calling?

2008-01-15 Thread J. Peng
Hello, I saw this statement in Core Python Programming book, All arguments of function calls are made by reference, meaning that any changes to these parameters within the function affect the original objects in the calling function. Does this mean there is not pass-values calling to a function

Re: Is str/unicode.encode supposed to work? with replace/ignore

2008-01-15 Thread Matt Nordhoff
BerlinBrown wrote: > With this code, ignore/replace still generate an error > > # Encode to simple ascii format. > field.full_content = field.full_content.encode('ascii', > 'replace') > > Error: > > [0/1] 'ascii' codec can't decode byte 0xe2 in positi

Asynchronous HTTP

2008-01-15 Thread Clement
Can i use asynchttp for http secure connection... If so plz how does it can be done. Is there any other library can do that that -- http://mail.python.org/mailman/listinfo/python-list

Re: reliable whois in python

2008-01-15 Thread Nikolas Karalis
I had done a project part of which was what you want to do. You can find it here... http://users.ntua.gr/ge04042/projects/dns/ Feel free to use the code. I hope this helps. Nikolas On Jan 15, 2008 5:48 AM, eliss <[EMAIL PROTECTED]> wrote: > Hi everyone, > > I'm trying to write a python script t

Re: no pass-values calling?

2008-01-15 Thread Steven D'Aprano
On Wed, 16 Jan 2008 11:09:09 +0800, J. Peng wrote: > Hello, > > I saw this statement in Core Python Programming book, > > All arguments of function calls are made by reference, meaning that any > changes to these parameters within the function affect the original > objects in the calling functio

What have you been up to

2008-01-15 Thread zegizuve10048
We have all the best Pian Meds discoveyamazing.com -- http://mail.python.org/mailman/listinfo/python-list

Image to browser

2008-01-15 Thread danielatdaveschool
Hi, noob here Im using mod_python and apache2 using psp for output of page, i open a file and resize it with the following code <% import Image, util fields = util.FieldStorage(req) filename = fields.getlist('src')[0] path = '/var/www/content/' + filename size = 128, 128 im = Image.open(path)

Re: Image to browser

2008-01-15 Thread danielatdaveschool
On Jan 16, 12:16 am, [EMAIL PROTECTED] wrote: > Hi, noob here > > Im using mod_python and apache2 using psp for output of page, i open a > file and resize it with the following code > > <% > import Image, util > > fields = util.FieldStorage(req) > filename = fields.getlist('src')[0] > > path = '/va

Re: Image to browser

2008-01-15 Thread Justin Ezequiel
On Jan 16, 1:19 pm, [EMAIL PROTECTED] wrote: > On Jan 16, 12:16 am, [EMAIL PROTECTED] wrote: > > > Im using mod_python and apache2 using psp for output of page, i open a > > file and resize it with the following code > > > <% > > import Image, util > > > fields = util.FieldStorage(req) > > filename

can't find pyAntTasks.properties

2008-01-15 Thread superwesman
Hi - I'm trying to use pyAntTasks. I downloaded the jar and placed it into ~/.ant/lib, put that directory into my CLASSPATH. I then created a very simple build.xml and I'm getting a failure I can't explain. Here is my build.xml: Here is my CLASSPATH: > echo $CLASSPATH /home/wtorres/.ant/

Re: no pass-values calling?

2008-01-15 Thread Christian Heimes
Dennis Lee Bieber wrote: > Since all "variable" names in Python are references to objects, > anything accessed using a name is accessed by reference. Anybody using the terms variable, reference or call-by-value is most likely explaining Python the wrong way. Sorry dude :) Christian -- ht

Re: no pass-values calling?

2008-01-15 Thread J. Peng
On Jan 16, 2008 1:45 PM, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Wed, 16 Jan 2008 11:09:09 +0800, "J. Peng" <[EMAIL PROTECTED]> > > alist = [] > anint = 2 > astr = "Touch me" > > dummy(alist, anint, astr) > > "dummy" can only modify the contents of the first argument -- the > inte

Re: Image to browser

2008-01-15 Thread danielatdaveschool
On Jan 16, 12:38 am, Justin Ezequiel <[EMAIL PROTECTED]> wrote: > On Jan 16, 1:19 pm, [EMAIL PROTECTED] wrote: > > > > > On Jan 16, 12:16 am, [EMAIL PROTECTED] wrote: > > > > Im using mod_python and apache2 using psp for output of page, i open a > > > file and resize it with the following code > >

Re: can't find pyAntTasks.properties

2008-01-15 Thread superwesman
On Jan 15, 11:41 pm, superwesman <[EMAIL PROTECTED]> wrote: > Hi - I'm trying to use pyAntTasks. I downloaded the jar and placed it > into ~/.ant/lib, put that directory into my CLASSPATH. I then created > a very simple build.xml and I'm getting a failure I can't explain. > > Here is my build.xml

Re: no pass-values calling?

2008-01-15 Thread Steven D'Aprano
On Wed, 16 Jan 2008 13:59:03 +0800, J. Peng wrote: > Hi, > > How to modify the array passed to the function? I tried something like > this: > a > [1, 2, 3] def mytest(x): > ... x=[4,5,6] This line does NOT modify the list [1, 2, 3]. What it does is create a new list, and assign it

Re: no pass-values calling?

2008-01-15 Thread Chris
On Jan 16, 7:59 am, "J. Peng" <[EMAIL PROTECTED]> wrote: > On Jan 16, 2008 1:45 PM, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > > > On Wed, 16 Jan 2008 11:09:09 +0800, "J. Peng" <[EMAIL PROTECTED]> > > > alist = [] > > anint = 2 > > astr = "Touch me" > > > dummy(alist, anint, astr) > > >

Re: no pass-values calling?

2008-01-15 Thread Ben Finney
Christian Heimes <[EMAIL PROTECTED]> writes: > Dennis Lee Bieber wrote: > > Since all "variable" names in Python are references to objects, > > anything accessed using a name is accessed by reference. > > Anybody using the terms variable, reference or call-by-value is most > likely explaining

Re: no pass-values calling?

2008-01-15 Thread J. Peng
On Jan 16, 2008 2:30 PM, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Wed, 16 Jan 2008 13:59:03 +0800, J. Peng wrote: > > > Hi, > > > > How to modify the array passed to the function? I tried something like > > this: > > > a > > [1, 2, 3] > def mytest(x): > > ... x=[4,5,6] > > > This

Re: no pass-values calling?

2008-01-15 Thread Christian Heimes
Ben Finney wrote: > The term "reference" is fine, since that's exactly how it works. One > gets at an object via some reference, be it a name or some access into > a container object. When an object has no more references to itself, > it becomes a candidate for garbage collection. And so on. Thank

Re: no pass-values calling?

2008-01-15 Thread J. Peng
On Jan 16, 2008 3:03 PM, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Wed, 16 Jan 2008 13:59:03 +0800, "J. Peng" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > > How to modify the array passed to the function? I tried something like this: > > > > >>> a > > [1, 2, 3] >

Re: Interesting Thread Gotcha

2008-01-15 Thread Hendrik van Rooyen
"Dan" wrote: > >>> keyboard_thread = thread.start_new_thread(kbd_driver (port_q,kbd_q)) > > Needs to be > >>> keyboard_thread = thread.start_new_thread(kbd_driver, (port_q,kbd_q)) > > Commas are important! > > -Dan Absolutely! - well spotted! As the first correct respondent, you win the fre

itertools.groupby

2008-01-15 Thread Tobiah
In the docs and examples that I have seen so far, it is suggested that the groupby() input list may be pre-sorted with the same function that is passed to groupby as a key extractor. I tried doing this with a simple example, but noticed that [].sort(func) passes two arguments to func, whereas the

Re: module naming conventions

2008-01-15 Thread Tobiah
> Release your package as free software on the Cheeseshop > http://cheeseshop.python.org/>. If the name you want is already > taken, pick one that will help users distinguish yours from the > existing one. > I like this idea. I developed a library with a name that got a couple of obscure softwa

Re: import from question

2008-01-15 Thread Tobiah
Duncan Booth wrote: > iu2 <[EMAIL PROTECTED]> wrote: > >> file a3.py: >> >> from a1 import the_number >> import a2 >> > ... >> Why doesn't it work in the first version of a3.py? >> > Think of 'import a2' as being the same as: > > a2 = __import__('a2') > > and 'from a1 import the_number'

Re: no pass-values calling?

2008-01-15 Thread Hrvoje Niksic
"J. Peng" <[EMAIL PROTECTED]> writes: > we create a new list and assign it to x for future use. How to > destroy the before list [1,2,3]? does python destroy it > automatically? Yes, Python detects that the older list is no longer in use (if that is indeed the case), and destroys it automaticall

Re: Memory problem with threading

2008-01-15 Thread Clement
On Jan 16, 5:24 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi! > > I made a string parser program, it has a main function and a working > thread class. When it is running in 24h non-stop, the memory run out. > I dont Know why. Do anybody know somekind of debugger that can i see > what is

<    1   2