Re: exception handling in complex Python programs

2008-08-20 Thread Richard Levasseur
One common-place thing I've noticed in a lot of python code is that every package or module has a main Error class, and all sub-types inherit from that class. So you just catch mylib.Error, and you're going to catch all the exceptions that package generates directly. There seems to be a lot of co

Re: The Importance of Terminology's Quality

2008-08-20 Thread Andrew Reilly
On Thu, 21 Aug 2008 02:36:39 +, sln wrote: >>Whats os interresting about all this hullabaloo is that nobody has coded >>machine code here, and know's squat about it. >> >>I'm not talking assembly language. Don't you know that there are >>routines that program machine code? Yes, burned in, bitw

Re: TRying to read sercah results from googles web page

2008-08-20 Thread James Matthews
I use this code. import urllib2 def urlopen(url): request = urllib2.Request(url) opener = urllib2.build_opener() request.add_header('User-Agent','Mozilla/5.0 (compatible;JewelersLoungeBot/1.0)') web_page = opener.open(request) return web_page On Wed, Aug 20, 2008 at 6:58 AM,

Re: Storing Passwords

2008-08-20 Thread James Matthews
Try using a salted SHA1 Hash On Wed, Aug 20, 2008 at 7:39 PM, Paul Rubin <"http://phr.cx"@nospam.invalid>wrote: > Paul Rubin writes: > > AF_UNIX sockets under Linux support these > > operations but I think the standard Python socket module > > currently d

Re: How to make xss safe strings

2008-08-20 Thread James Matthews
If you are using a framework there should be a urlencode feature within the framework. On Wed, Aug 20, 2008 at 8:58 PM, Dan Bishop <[EMAIL PROTECTED]> wrote: > On Aug 20, 10:10 pm, Roopesh <[EMAIL PROTECTED]> wrote: > > Hi, > > > > How can I make a string XSS safe? Will > > simply .replace('<','<

Re: Prevalent Python/Django academic software

2008-08-20 Thread James Matthews
I have sent this to the Django Mailing list so you can get it from two sources On Wed, Aug 20, 2008 at 9:07 PM, Daniel Bickett <[EMAIL PROTECTED]> wrote: > Is anyone working on any software at present, using django or python > in general, which serves various academic/course functions, or else >

Re: Bizarre method keyword-arg bug.

2008-08-20 Thread Steven D'Aprano
On Wed, 20 Aug 2008 15:58:44 -0400, Robert Brown wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: >> On Wed, 20 Aug 2008 13:09:21 -0400, Robert Brown wrote: >> >>> In any case, chances are high that Lisp's way of handling default >>> arguments would have been changed had it been shown to cause

Re: urllib fails to connect

2008-08-20 Thread jlist
Thanks. My problem was not how to use a proxy server but how to not use the IE proxy :) BTW, I'm not a fan of the way urllib2 uses a proxy particularly. I think it's really unneccesarily complicated. I think it should be something like this: def urlopen(url, proxy='') And if you want to use a pro

Re: iterparse and unicode

2008-08-20 Thread Fredrik Lundh
George Sakkis wrote: > Thank you both for the suggestions. I made a few more experiments to > understand how iterparse behaves with respect to three dimensions: Spending time researching undefined behaviour is pretty pointless. ET parsers expect byte streams, because that's what XML files are.

Re: subprocess seems to "detach" / ignore wait()

2008-08-20 Thread Mathieu Prevot
2008/8/21 Mathieu Prevot <[EMAIL PROTECTED]>: > 2008/8/20 Gabriel Genellina <[EMAIL PROTECTED]>: >> En Wed, 20 Aug 2008 12:22:16 -0300, Wojtek Walczak <[EMAIL PROTECTED]> >> escribió: >> >>> On Wed, 20 Aug 2008 15:09:11 +0200, Mathieu Prevot wrote: >>> child = Popen(cmd.split(), stderr=flog

Re: python custom command interpreter?

2008-08-20 Thread Martin
I guess you are looking for this: http://docs.python.org/lib/module-cmd.html On Wed, Aug 20, 2008 at 9:19 PM, joey boggs <[EMAIL PROTECTED]> wrote: > I've got a hopefully simple question, maybe I'm just not searching for the > right information. > > I'm working on a project that is using kickstar

Re: exception handling in complex Python programs

2008-08-20 Thread Gabriel Genellina
En Wed, 20 Aug 2008 21:49:14 -0300, [EMAIL PROTECTED] <[EMAIL PROTECTED]> escribió: > On Aug 20, 10:59 am, Steven D'Aprano <[EMAIL PROTECTED] > cybersource.com.au> wrote: >> Oh goodie. Another programmer who goes out of his way to make it hard for >> other programmers, by destroying duck-typing.

Re: subprocess seems to "detach" / ignore wait()

2008-08-20 Thread Mathieu Prevot
2008/8/20 Gabriel Genellina <[EMAIL PROTECTED]>: > En Wed, 20 Aug 2008 12:22:16 -0300, Wojtek Walczak <[EMAIL PROTECTED]> > escribió: > >> On Wed, 20 Aug 2008 15:09:11 +0200, Mathieu Prevot wrote: >> >>> child = Popen(cmd.split(), stderr=flog) >>> print "Server running [PID %s]"%(child.pid) >>

Re: iterparse and unicode

2008-08-20 Thread Fredrik Lundh
George Sakkis wrote: Traceback (most recent call last): File "", line 1, in File "", line 64, in __iter__ UnicodeEncodeError: 'ascii' codec can't encode characters in position 6-15: ordinal not in range(128) Am I using it incorrectly or it doesn't currently support unicode ? iterparse pa

Re: python custom command interpreter?

2008-08-20 Thread Fredrik Lundh
Marc 'BlackJack' Rintsch wrote: How so? What could be easier than "rm -rf directory"? C:\>rm -rf directory Illegal command: rm. Hm. ;-) does CentOS/Fedora run Windows these days? -- http://mail.python.org/mailman/listinfo/python-list

Re: Factory for Struct-like classes

2008-08-20 Thread Dave Benjamin
eliben wrote: Whaaa? Named tuples are being added to Python? Neat! Is there any documentation on this? I can't seem to find anything on the web... It's not easy to find unless you recall where you've seen it: http://docs.python.org/dev/3.0/library/collections.html#collections.namedtuple Thank

Re: python custom command interpreter?

2008-08-20 Thread Marc 'BlackJack' Rintsch
On Wed, 20 Aug 2008 18:46:42 -0400, Derek Martin wrote: > How so? What could be easier than "rm -rf directory"? C:\>rm -rf directory Illegal command: rm. Hm. ;-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: exception handling in complex Python programs

2008-08-20 Thread Steven D'Aprano
On Wed, 20 Aug 2008 17:49:14 -0700, [EMAIL PROTECTED] wrote: > On Aug 20, 10:59 am, Steven D'Aprano <[EMAIL PROTECTED] > cybersource.com.au> wrote: >> Oh goodie. Another programmer who goes out of his way to make it hard >> for other programmers, by destroying duck-typing. > > Remember kids: pers

Re: Factory for Struct-like classes

2008-08-20 Thread eliben
On Aug 21, 4:51 am, Dave Benjamin <[EMAIL PROTECTED]> wrote: > Christian Heimes wrote: > > eliben wrote: > >> Ruby's 'Scruct' class (http://ruby-doc.org/core/classes/Struct.html) > >> does this. I suppose it can be done with 'exec', but is there a more > >> Pythonic way ? > > > Try named tuplehttp:

Re: Get parameters from the URL

2008-08-20 Thread Marc 'BlackJack' Rintsch
On Thu, 21 Aug 2008 10:04:35 +0530, Sohrab Pawar wrote: > I'm a python noob so don't be mean :) I have a URL like > http://mySite.net?userID=398&age=28 I'm trying to create a new python > script that is called when a user click a button "Redirect". When a user > clicks the "Redirect" button, I wan

Get parameters from the URL

2008-08-20 Thread Sohrab Pawar
Hi all, I'm a python noob so don't be mean :) I have a URL like http://mySite.net?userID=398&age=28 I'm trying to create a new python script that is called when a user click a button "Redirect". When a user clicks the "Redirect" button, I want to send the user to either of the 2 pages, dependin

Re: Negative integers

2008-08-20 Thread eliben
On Aug 21, 1:30 am, Ethan Furman <[EMAIL PROTECTED]> wrote: > nntpman68 wrote: > > johnewing wrote: > > >> I am trying to figure out how to test if two numbers are of the same > >> sign (both positive or both negative).  I have tried > > >> abs(x) / x == abs(y) / y > > >> but that fails when one of

Prevalent Python/Django academic software

2008-08-20 Thread Daniel Bickett
Is anyone working on any software at present, using django or python in general, which serves various academic/course functions, or else that of student-instructor arbitration? A popular example which my university uses is the "Blackboard Academic Suite" (wpedia:Blackboard Inc.), which offers a wid

Re: How to make xss safe strings

2008-08-20 Thread Dan Bishop
On Aug 20, 10:10 pm, Roopesh <[EMAIL PROTECTED]> wrote: > Hi, > > How can I make a string XSS safe? Will > simply .replace('<','<').replace('>','>') do the work? Or > are there some other issues to take into account?. Is there already a > function in python which will do this for me. For HTML,

RELEASED Python 2.6b3 and 3.0b3

2008-08-20 Thread Barry Warsaw
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On behalf of the Python development team and the Python community, I am happy to announce the third and last planned beta releases of Python 2.6 and Python 3.0. Please note that these are beta releases, and as such are not suitable for production envi

How to make xss safe strings

2008-08-20 Thread Roopesh
Hi, How can I make a string XSS safe? Will simply .replace('<','<').replace('>','>') do the work? Or are there some other issues to take into account?. Is there already a function in python which will do this for me. Regards Roopesh -- http://mail.python.org/mailman/listinfo/python-list

what's wrong with www.planetpython.org?

2008-08-20 Thread momobear
hi, Does anyone know why the www.planetpython.org could not be connected recently? thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Factory for Struct-like classes

2008-08-20 Thread Dave Benjamin
Christian Heimes wrote: eliben wrote: Ruby's 'Scruct' class (http://ruby-doc.org/core/classes/Struct.html) does this. I suppose it can be done with 'exec', but is there a more Pythonic way ? Try named tuple http://code.activestate.com/recipes/500261/ A named tuple implementation is part of Py

Re: iterparse and unicode

2008-08-20 Thread George Sakkis
Thank you both for the suggestions. I made a few more experiments to understand how iterparse behaves with respect to three dimensions: a. Is the encoding declared in the header (if there is one) ? b. Is the text ascii-encodable (i.e. within range(128)) ? c. Does the passed file object's read() me

Re: Debugging of a long running process under Windows

2008-08-20 Thread R. Bernstein
I don't know how well Microsoft Windows allows for sending a process a signal in Python, but if the Python signal module works reasonably well on Microsoft Windows, then reread http://bashdb.sourceforge.net/pydb/pydb/lib/node38.html Should you not want to use or can't use pydb, or want to do this

Re: Storing Passwords

2008-08-20 Thread Paul Rubin
Paul Rubin writes: > AF_UNIX sockets under Linux support these > operations but I think the standard Python socket module > currently doesn't implement them. I sort of remember seeing a > patch in the bug tracker for the purpose, but maybe I'm thinkin

Re: The Importance of Terminology's Quality

2008-08-20 Thread sln
On Thu, 21 Aug 2008 02:30:27 GMT, [EMAIL PROTECTED] wrote: >On Wed, 20 Aug 2008 21:18:22 -0500, [EMAIL PROTECTED] (Rob Warnock) wrote: > >>Martin Gregorie <[EMAIL PROTECTED]> wrote: >>+--- >>| I was fascinated, though by the designs of early assemblers: I first >>| learnt Elliott ass

Re: Storing Passwords

2008-08-20 Thread Paul Rubin
"Eric Wertman" <[EMAIL PROTECTED]> writes: > I whipped up something using base64 and pickle, to keep them in > a dictionary and at least prevent them from being plain text, but it > seems a bit insecure all the same. Any ideas, much appreciated. If you want people other than yourself to be able

Re: The Importance of Terminology's Quality

2008-08-20 Thread sln
On Wed, 20 Aug 2008 21:18:22 -0500, [EMAIL PROTECTED] (Rob Warnock) wrote: >Martin Gregorie <[EMAIL PROTECTED]> wrote: >+--- >| I was fascinated, though by the designs of early assemblers: I first >| learnt Elliott assembler, which required the op codes to be typed on >| octal but u

Re: The Importance of Terminology's Quality

2008-08-20 Thread Rob Warnock
Martin Gregorie <[EMAIL PROTECTED]> wrote: +--- | I was fascinated, though by the designs of early assemblers: I first | learnt Elliott assembler, which required the op codes to be typed on | octal but used symbolic labels and variable names. Meanwhile a colleague | had started on a

Re: The Importance of Terminology's Quality

2008-08-20 Thread Rob Warnock
John W Kennedy <[EMAIL PROTECTED]> wrote: +--- | I said "machine language" and I meant it. I haven't touched a 1401 since | 1966, and haven't dealt with a 1401 emulator since 1968, but I can | /still/ write a self-booting program. +--- Heh! I never dealt with a 1401 per

RE: python custom command interpreter?

2008-08-20 Thread joey boggs
-- Forwarded message -- From: joey boggs <[EMAIL PROTECTED]> Date: Wed, Aug 20, 2008 at 9:46 PM Subject: Re: python custom command interpreter? To: Derek Martin <[EMAIL PROTECTED]> That was my first approach, but it's not clean enough -point at interpreter - DROP /directory That

Delivery Status Notification (Failure)

2008-08-20 Thread TOM MCCULLOUGH
You Suck big time! <>-- http://mail.python.org/mailman/listinfo/python-list

Re: exception handling in complex Python programs

2008-08-20 Thread [EMAIL PROTECTED]
On Aug 20, 10:59 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > Oh goodie. Another programmer who goes out of his way to make it hard for > other programmers, by destroying duck-typing. Remember kids: personal attacks are cruise control for cool. So this was a simplification

Re: iterparse and unicode

2008-08-20 Thread John Krukoff
On Wed, 2008-08-20 at 15:36 -0700, George Sakkis wrote: > It seems xml.etree.cElementTree.iterparse() is not unicode aware: > > >>> from StringIO import StringIO > >>> from xml.etree.cElementTree import iterparse > >>> s = > >>> u'\u03a0\u03b1\u03bd\u03b1\u03b3\u03b9\u03ce\u03c4\u03b7\u03c2' > >>

Re: who to call a list of method inside the class itself

2008-08-20 Thread John Machin
On Aug 20, 11:19 pm, Ricardo Aráoz <[EMAIL PROTECTED]> wrote: > Terry Reedy wrote: > > > [EMAIL PROTECTED] wrote: > >> Is the following code is ok. who to call all method. > >> It is working but the call to m() without a reference to self seems > >> strange > > > The reference to self is bound to

Re: python custom command interpreter?

2008-08-20 Thread Mitko Haralanov
On Wed, 20 Aug 2008 15:19:19 -0400 "joey boggs" <[EMAIL PROTECTED]> wrote: > In the end I'd like to be able to run a custom interpreter and just feed it > one command and a directory. The end result in the kickstart something like > this: > > %post --interpreter #!/usr/bin/myinterpreter > DROP /t

Re: Negative integers

2008-08-20 Thread johnewing
I managed to change my dataflow so that an earlier test rules out the possibility of a zero there. Still, thank you for the fast answers, this is my first time using the forum. Hopefully I will be able to be on the question answering end before too long. thanks again, john -- http://mail.python.o

Re: Negative integers

2008-08-20 Thread Derek Martin
On Wed, Aug 20, 2008 at 02:38:11PM -0700, johnewing wrote: > I am trying to figure out how to test if two numbers are of the same > sign (both positive or both negative). I have tried > > abs(x) / x == abs(y) / y Zero is a problem, no matter how you slice it. Zero can be considered positive or

Dock box order

2008-08-20 Thread Rev. Raymond Anderson
Hello, My name is Rev. Raymond Anderson. Can you Please provide unit cost on your dock boxes with the dimension ( 46"W x 26"D x 27"H ) to enable me choose the quantities i will like to purchase. Hope to hear back from you. with kind regards Rev. Raymond Anderson. D -- http://mail.python.org/mail

Re: iterparse and unicode

2008-08-20 Thread John Machin
On Aug 21, 8:36 am, George Sakkis <[EMAIL PROTECTED]> wrote: > It seems xml.etree.cElementTree.iterparse() is not unicode aware: > > >>> from StringIO import StringIO > >>> from xml.etree.cElementTree import iterparse > >>> s = > >>> u'\u03a0\u03b1\u03bd\u03b1\u03b3\u03b9\u03ce\u03c4\u03b7\u03c2'

Re: python custom command interpreter?

2008-08-20 Thread Derek Martin
On Wed, Aug 20, 2008 at 03:19:19PM -0400, joey boggs wrote: > In the end I'd like to be able to run a custom interpreter and just feed it > one command and a directory. The end result in the kickstart something like > this: > > %post --interpreter #!/usr/bin/myinterpreter > DROP /tmp/directory > D

shyam

2008-08-20 Thread syam
E-mail:[EMAIL PROTECTED] web - http://www.shyamalaindian.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

shyam

2008-08-20 Thread syam
E-mail:[EMAIL PROTECTED] web - http://www.shyamalaindian.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

iterparse and unicode

2008-08-20 Thread George Sakkis
It seems xml.etree.cElementTree.iterparse() is not unicode aware: >>> from StringIO import StringIO >>> from xml.etree.cElementTree import iterparse >>> s = >>> u'\u03a0\u03b1\u03bd\u03b1\u03b3\u03b9\u03ce\u03c4\u03b7\u03c2' >>> for event,elem in iterparse(StringIO(s)): ... print elem.text ..

Re: who to call a list of method inside the class itself

2008-08-20 Thread Ricardo Aráoz
Terry Reedy wrote: [EMAIL PROTECTED] wrote: Is the following code is ok. who to call all method. It is working but the call to m() without a reference to self seems strange The reference to self is bound to the methods by the way you look them up. class CustomMethod: def method1(self)

Re: Negative integers

2008-08-20 Thread John Machin
On Aug 21, 7:46 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > johnewing wrote: > > I am trying to figure out how to test if two numbers are of the same > > sign (both positive or both negative). I have tried > > > abs(x) / x == abs(y) / y > > > but that fails when one of the numbers is 0. I'm su

Re: Negative integers

2008-08-20 Thread Ethan Furman
nntpman68 wrote: johnewing wrote: I am trying to figure out how to test if two numbers are of the same sign (both positive or both negative). I have tried abs(x) / x == abs(y) / y but that fails when one of the numbers is 0. I'm sure that there is an easy way to do this. Any suggestions?

Re: Negative integers

2008-08-20 Thread nntpman68
Hi, Dan's solution is probably the clearest. Just out of curiousity:. How would you in your program's context like 0 to be treated. should it be treated as a positive number or should it be treated as a case part. my suggestion a*b > 0 for example wouldn't work if you want 0 to be treated as

Re: Negative integers

2008-08-20 Thread Christian Heimes
johnewing wrote: but that fails when one of the numbers is 0. I'm sure that there is an easy way to do this. Any suggestions? For the not-so-distant future: Python 2.6 and 3.0 have a new function "copysign" in the math module. I added it during the revamp of the math module. copysign(x, y)

Re: Negative integers

2008-08-20 Thread nntpman68
Hm, It seems my previous reply got lost. if a*b > 0: print "same sign" else print "different sign" johnewing wrote: I am trying to figure out how to test if two numbers are of the same sign (both positive or both negative). I have tried abs(x) / x == abs(y) / y but that f

Re: Negative integers

2008-08-20 Thread Dan Stromberg
On Wed, 20 Aug 2008 14:38:11 -0700, johnewing wrote: > I am trying to figure out how to test if two numbers are of the same > sign (both positive or both negative). I have tried > > abs(x) / x == abs(y) / y > > but that fails when one of the numbers is 0. I'm sure that there is an > easy way t

Re: Negative integers

2008-08-20 Thread Vlastimil Brom
2008/8/20 johnewing <[EMAIL PROTECTED]> > I am trying to figure out how to test if two numbers are of the same > sign (both positive or both negative). I have tried > > abs(x) / x == abs(y) / y > > but that fails when one of the numbers is 0. I'm sure that there is > an easy way to do this. Any

Re: python custom command interpreter?

2008-08-20 Thread Fredrik Lundh
joey boggs wrote: That's kinda what I'm looking for, but it can't be interactive > as there's no way to send input during the installation. It should pass the DROP statements to the interpreter and the > interpreter takes the input and runs os.rmdir() > or something similar. This way the back

Re: Detect a sequence of keystrokes in an os independent way

2008-08-20 Thread Fredrik Lundh
Rajanikanth Jammalamadaka wrote: Can somebody tell me if there is an os independent way to detect a sequence of key strokes. For example, I want to start some other program once the user presses a couple of keys: ex: key a and then key http://effbot.org/pyfaq/how-do-i-get-a-single-keypress-at-

Re: Negative integers

2008-08-20 Thread Fredrik Lundh
johnewing wrote: I am trying to figure out how to test if two numbers are of the same sign (both positive or both negative). I have tried abs(x) / x == abs(y) / y but that fails when one of the numbers is 0. I'm sure that there is an easy way to do this. Any suggestions? (a < 0) == (b < 0

Re: Detect a sequence of keystrokes in an os independent way

2008-08-20 Thread Rajanikanth Jammalamadaka
Hi! I was able to do this in the following way: import os fKey= raw_input('') if fKey=='ab': print(os.listdir(os.getcwd())) Is there a better way to do this? Thanks, Raj On Wed, Aug 20, 2008 at 2:21 PM, Rajanikanth Jammalamadaka <[EMAIL PROTECTED]> wrote: > Hi! > > Can somebody tell

Negative integers

2008-08-20 Thread johnewing
I am trying to figure out how to test if two numbers are of the same sign (both positive or both negative). I have tried abs(x) / x == abs(y) / y but that fails when one of the numbers is 0. I'm sure that there is an easy way to do this. Any suggestions? Thanks -- http://mail.python.org/mailm

Detect a sequence of keystrokes in an os independent way

2008-08-20 Thread Rajanikanth Jammalamadaka
Hi! Can somebody tell me if there is an os independent way to detect a sequence of key strokes. For example, I want to start some other program once the user presses a couple of keys: ex: key a and then key b Thanks, Raj -- "For him who has conquered the mind, the mind is the best of friends;

Re: Find file in a given search path

2008-08-20 Thread Gabriel Genellina
En Wed, 20 Aug 2008 17:10:15 -0300, aditya shukla <[EMAIL PROTECTED]> escribió: > Hello folks, i am trying to find a particular file in a given search path.I > found code for this on internet. > > if __name__ == '___main__': >search_path = '/bin' + pathsep + '/usr/bin' # ; on windows, : on un

Re: python custom command interpreter?

2008-08-20 Thread joey boggs
That's kinda what I'm looking for, but it can't be interactive as there's no way to send input during the installation. It should pass the DROP statements to the interpreter and the interpreter takes the input and runs os.rmdir() or something similar. This way the backend does all the work and the

py2exe importing a package not in library.zip

2008-08-20 Thread mypetslug
Hi, I'm sorry if this has been asked before, but I can't seem to find an answer to this anywhere and so far, trial and error hasn't gotten me far either. Using python 2.4, I've created a testing application. When the app starts up, I do a [code]from tests import *[/code] and it looks at the /test

Re: os.readlink() doco snafu?

2008-08-20 Thread Miles
Fredrik Lundh wrote: > JBW wrote: >> I'm not sure readlink() lives up to its documentation. ... >> The result makes sense, but it belies the documentation. Should I report >> this? Or is there another plausible interpretation? > > the part about joining with dirname(path) assumes that you pass in

Re: urllib fails to connect

2008-08-20 Thread Edwin . Madari
jlist wrote: > > I found out why. I set a proxy in IE and I didn't know > ActiveState Python use IE proxy! > > > I'm running ActiveState Python 2.5 on Windows XP. It used > > to work fine. Today however I get (10061, 'Connection refused') > > for any site I try with urllib.urlopen(). > switching

Re: subprocess seems to "detach" / ignore wait()

2008-08-20 Thread Gabriel Genellina
En Wed, 20 Aug 2008 12:22:16 -0300, Wojtek Walczak <[EMAIL PROTECTED]> escribió: > On Wed, 20 Aug 2008 15:09:11 +0200, Mathieu Prevot wrote: > >> child = Popen(cmd.split(), stderr=flog) >> print "Server running [PID %s]"%(child.pid) >> fpid.write(child.pid) > > I think that the problem here

Find file in a given search path

2008-08-20 Thread aditya shukla
Hello folks, i am trying to find a particular file in a given search path.I found code for this on internet. Code from os.path import exists, join from os import pathsep from string import split def search_file(filename, search_path): """Given a search path, find file """ file_found = 0

Re: Bizarre method keyword-arg bug.

2008-08-20 Thread Robert Brown
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Wed, 20 Aug 2008 13:09:21 -0400, Robert Brown wrote: > >> In any case, chances are high that Lisp's way of handling default >> arguments would have been changed had it been shown to cause performance >> problems. > > But nobody is suggesting that it

Re: python custom command interpreter?

2008-08-20 Thread Fredrik Lundh
joey boggs wrote: In the end I'd like to be able to run a custom interpreter and just feed it one command and a directory. The end result in the kickstart something like this: %post --interpreter #!/usr/bin/myinterpreter DROP /tmp/directory DROP /tmp/directory2 How would I setup the interpre

Re: urllib fails to connect

2008-08-20 Thread Fredrik Lundh
jlist wrote: My guess is urllib.urlopen() wraps the wininet calls, which share IE proxy settings. urllib doesn't use wininet, but it does fetch the proxy settings from the Windows registry. -- http://mail.python.org/mailman/listinfo/python-list

Re: os.readlink() doco snafu?

2008-08-20 Thread Fredrik Lundh
JBW wrote: I'm not sure readlink() lives up to its documentation. To wit: $ touch bar # Create an empty file $ ln -s bar foo # And a symlink to it. $ python Python 2.5.1 <... Herald "the snitch" Redacted ...> Type "help", "copyright", "credits" or "license" for more infor

Re: Sorting an array on the nth element in a list

2008-08-20 Thread Vlastimil Brom
2008/8/20 Ron Brennan <[EMAIL PROTECTED]> > > > Hello, > > I am trying to parse a log file. I want to sort based on the second > element the list that is in the file. > > What is the best way to do this? The sort is just on the line itself where > I want to re-organize the lines based on the sec

os.readlink() doco snafu?

2008-08-20 Thread JBW
English is my first language, but I doesn't be very good at it. I was trying to endow my symlinked python module with the ability to divine where it actually resides when I came across os.readlink(), documented at http://docs.python.org/lib/os-file-dir.html I'm not sure readlink() lives up to

python custom command interpreter?

2008-08-20 Thread joey boggs
I've got a hopefully simple question, maybe I'm just not searching for the right information. I'm working on a project that is using kickstarts to build Fedora/CentOS variant machines. Within the kickstart in the post section we will be performing disk space reductions by removing any unnecessary

Sorting an array on the nth element in a list

2008-08-20 Thread Ron Brennan
Hello, I am trying to parse a log file. I want to sort based on the second element the list that is in the file. What is the best way to do this? The sort is just on the line itself where I want to re-organize the lines based on the second element of the csv file Thanks, Ron -- http://mail.pyt

Re: exception handling in complex Python programs

2008-08-20 Thread Marc 'BlackJack' Rintsch
On Wed, 20 Aug 2008 18:37:02 +0200, Bruno Desthuilliers wrote: >> I personally think this is sloppy because you have to couple the >> exception type with the function --- between file() and open() in >> Python 2 and 3, a NameError is thrown with open() in Python 3 > > ??? I suspect this has nothi

evaluating code lines above breakpoints ?

2008-08-20 Thread Stef Mientki
hello, I'm trying to create a high level debugger, based on rpd2. So when the debugger enters a breakpoint, I want to display the values of all variables in the, let's say, 5 lines above the breakpoint (if possible). Any hints on how I get a list of all vars in those lines ? My rough idea is to

Re: urllib fails to connect

2008-08-20 Thread jlist
My guess is urllib.urlopen() wraps the wininet calls, which share IE proxy settings. > Perhaps IE's proxy settings are effectively setting the Windows system > networking proxy settings? -- http://mail.python.org/mailman/listinfo/python-list

Re: Bizarre method keyword-arg bug.

2008-08-20 Thread Steven D'Aprano
On Wed, 20 Aug 2008 13:09:21 -0400, Robert Brown wrote: > In any case, chances are high that Lisp's way of handling default > arguments would have been changed had it been shown to cause performance > problems. But nobody is suggesting that it would cause performance problems in *Lisp*. It might

Re: exception handling in complex Python programs

2008-08-20 Thread Steven D'Aprano
On Wed, 20 Aug 2008 09:23:22 -0700, [EMAIL PROTECTED] wrote: > On Aug 19, 4:12 pm, Steven D'Aprano <[EMAIL PROTECTED] > cybersource.com.au> wrote: >> On Tue, 19 Aug 2008 11:07:39 -0700, [EMAIL PROTECTED] wrote: >> >   def do_something(filename): >> >     if not os.access(filename,os.R_OK): >> >  

Boost Python DLL from Boost Pro is built incorrectly?

2008-08-20 Thread Stodge
I'm having issues with Boost Python, downloaded via http://www.boostpro.com. I *think* it's related to WinXP side by side assemblies. My application that uses Boost Python fails to start. I ran dependancy walker on the Boost Python DLL and I get the following: Error: The Side-by-Side configuratio

Re: Python Wiimote

2008-08-20 Thread nntpman68
Hi Ken, Yes, I'm interested in using the Wiimote with Python. However so far I did not use ('use' means 'just try') the Wiimote with anything except Glovepie. There's three setups I'm interested in (less Python, than a general setup issues so far): - Wiimote with Windows XP: Problem is, tha

Re: urllib fails to connect

2008-08-20 Thread Trent Mick
jlist wrote: I found out why. I set a proxy in IE and I didn't know ActiveState Python use IE proxy! I'm running ActiveState Python 2.5 on Windows XP. It used to work fine. Today however I get (10061, 'Connection refused') for any site I try with urllib.urlopen(). Perhaps IE's proxy settings

Re: urllib fails to connect

2008-08-20 Thread raashid bhatt
On Aug 20, 10:06 am, "jlist" <[EMAIL PROTECTED]> wrote: > I'm running ActiveState Python 2.5 on Windows XP. It used > to work fine. Today however I get (10061, 'Connection refused') > for any site I try with urllib.urlopen(). May be the host is Listening on the port you are connecting to or the ho

Re: getattr() on nested functions?

2008-08-20 Thread Terry Reedy
Gabriel Rossetti wrote: Bruno Desthuilliers wrote: Gabriel Rossetti a écrit : I thought that since functions are objects, that I could obtain it's nested functions. Well, there's probably a very hackish way, but it's not worth the pain. What Bruno meant here, I believe, is that there i

Re: urllib fails to connect

2008-08-20 Thread jlist
I found out why. I set a proxy in IE and I didn't know ActiveState Python use IE proxy! > I'm running ActiveState Python 2.5 on Windows XP. It used > to work fine. Today however I get (10061, 'Connection refused') > for any site I try with urllib.urlopen(). -- http://mail.python.org/mailman/list

Re: Bizarre method keyword-arg bug.

2008-08-20 Thread Robert Brown
Fredrik Lundh <[EMAIL PROTECTED]> writes: > Robert Brown wrote: >> You may find the above surprising, but Common Lisp users expect the >> default argument expression to be evaluated anew when needed by a >> function call: > > well, I'd say an argument based on "Common Lisp users" is a lot more > du

urllib fails to connect

2008-08-20 Thread jlist
I'm running ActiveState Python 2.5 on Windows XP. It used to work fine. Today however I get (10061, 'Connection refused') for any site I try with urllib.urlopen(). -- http://mail.python.org/mailman/listinfo/python-list

Python Wiimote

2008-08-20 Thread xkenneth
All, I've just recently started fiddling with my Wiimote using python and PyBluez. I'm interested particular in getting the position IR sensor data out of the Wiimote, but I'd like to develop a library that let's you access all of it easily in an OO manner. If anyone has any interest in explo

Re: exception handling in complex Python programs

2008-08-20 Thread Rafe
On Aug 20, 12:47 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Rafe wrote: > > Again, this is probably too simple to help, but the only way to ignore > > certain types of exceptions, as far as I know, is to catch them and > > pass. > > e.g. this ignores type errors... > > > try: > > somethingB

Re: exception handling in complex Python programs

2008-08-20 Thread Bruno Desthuilliers
eliben a écrit : This is *exactly* my concern with Python exceptions. You just never know what can be thrown at you. This rarely happen to be a problem in real life. At least not in mine. Exception that can be expected (ie : IOError when dealing with files) are usually obvious and more or le

Re: exception handling in complex Python programs

2008-08-20 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : On Aug 19, 10:19 am, eliben <[EMAIL PROTECTED]> wrote: P.S. There's a common case where a method is passed a filename, to do something with a file (say, read data). Should the method catch the errors possibly thrown by open(), or leave it to the caller ? You want t

Re: exception handling in complex Python programs

2008-08-20 Thread [EMAIL PROTECTED]
On Aug 19, 4:12 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Tue, 19 Aug 2008 11:07:39 -0700, [EMAIL PROTECTED] wrote: > >   def do_something(filename): > >     if not os.access(filename,os.R_OK): > >       return err(...) > >     f = open(filename) > >     ... > > You're

>>>>>>>>FREE MONEY LINKS <<<<<<<<<<

2008-08-20 Thread [EMAIL PROTECTED]
LINK <<< LINK >>> LINK <<< LINK >>$ FREE MONEY RIGISTERED $<<< FREE Registered On Site http://rex.boobslove.info/voyngojchngogua/vegas/girl/sex/videos/ http://www.unregisteredlookup.com/refunded_domains/2007/march/17/com/com_march_17_2007

Re: subprocess seems to "detach" / ignore wait()

2008-08-20 Thread Wojtek Walczak
On Wed, 20 Aug 2008 15:09:11 +0200, Mathieu Prevot wrote: > flog = open(logfile, 'w') > fpid = open(pidfile, 'w') > try: > child = Popen(cmd.split(), stderr=flog) > print "Server running [PID %s]"%(child.pid) > fpid.write(child.pid) What happens if you change: fpid.write(child.pid) into:

Re: getattr() on nested functions?

2008-08-20 Thread Gabriel Rossetti
Bruno Desthuilliers wrote: Gabriel Rossetti a écrit : Hello, I can't get getattr() to return nested functions, Of course. Nested functions are not attributes of their container function. Ok I tried this : >>> def toto(): ... def titi(): ... pass ... f = getattr(toto

  1   2   >