Re: is +=1 thread safe

2008-05-02 Thread Arnaud Delobelle
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: > On Fri, 02 May 2008 19:23:54 +0100, Arnaud Delobelle wrote: > >> Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: >> >>> >>> There are no modern processors with an opcode for incrementing a memory >>> location!? At least my C64 can do th

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Torsten Bronger
Hallöchen! Gabriel Genellina writes: > [...] > > I can't believe some angry responses in this thread - it's just a > technical question, not about which is the best team in the > [preferred sports here] National Championship... Well, Python-list is tunnelled to Usenet. Welcome here. ;-) Tschö

Re: is +=1 thread safe

2008-05-02 Thread Marc 'BlackJack' Rintsch
On Fri, 02 May 2008 19:23:54 +0100, Arnaud Delobelle wrote: > Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: > >> >> There are no modern processors with an opcode for incrementing a memory >> location!? At least my C64 can do that. ;-) > > Indeed! I remember a simple use was to make the

Re: Finally had to plonk google gorups.

2008-05-02 Thread George Sakkis
On May 2, 4:49 pm, Mensanator <[EMAIL PROTECTED]> wrote: > On May 2, 2:57 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > > On May 2, 1:18 pm, Mensanator <[EMAIL PROTECTED]> wrote: > > > > On May 2, 9:53 am, Michael Torrie <[EMAIL PROTECTED]> wrote: > > > > > Shawn Milochik wrote: > > > > > Ho

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Ben Finney
Ben Finney <[EMAIL PROTECTED]> writes: > The shebang line (the initial line of the file beginning with "#!") > takes advantage of OS kernels that determine how to execute a file > based on the first few bytes of the file. The shebang line tells the > kernel that this file should be executed by pas

CHINA WHOLESALE GUCCI DIOR CHANEL HANDBAGS FROM CHINA SUPPLIERS

2008-05-02 Thread myshoesbiz89
Thenikeshoes DOT net If you are interested in any of our products, please contact our salesman and they will respond in 24 hours after hearing from you. If you cannot find the shoes you are seeking for in the list, please also contact with us and send us your photos, we will do our best to find t

Re: Pyserial - send and receive characters through linux serial port

2008-05-02 Thread Gabriel Genellina
En Fri, 02 May 2008 15:44:09 -0300, terry <[EMAIL PROTECTED]> escribió: On May 2, 10:26 am, terry <[EMAIL PROTECTED]> wrote: On Apr 26, 8:21 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > Much of the time the exercise of writing a small demo program > will lead you to the answer.  If not, then

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Gabriel Genellina
En Fri, 02 May 2008 12:07:55 -0300, D'Arcy J.M. Cain <[EMAIL PROTECTED]> escribió: On Sat, 03 May 2008 00:43:02 +1000 Ben Finney <[EMAIL PROTECTED]> wrote: Roy Smith <[EMAIL PROTECTED]> writes: > Have you ever shipped software to a customer? Yes, and all parties have been quite happy with t

Re: RegEx for matching brackets

2008-05-02 Thread Derek Martin
On Fri, May 02, 2008 at 03:51:16PM -0700, NevilleDNZ wrote: > Thanx for the link to these parsers. ANTLR looks interesting. > Yoyo: http://www-users.cs.york.ac.uk/~fisher/software/yoyovwg/readme > > I figured out a way to do it in python. [...] > > def check_open_close(str): > try: > eval("

Re: IPv6 and Python

2008-05-02 Thread Roy Smith
In article <[EMAIL PROTECTED]>, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > Thanks a lot. I've been able to listen on ::1:21 after having > installed IPv6 on both Windows and Linux thanks to your suggestions. > I'd like to ask one more question: is it possible to bind my server on > both IP

Re: unified command line args, environment variables, .conf file settings.

2008-05-02 Thread Ben Finney
smitty1e <[EMAIL PROTECTED]> writes: > Just a fun exercise to unify some of the major input methods for a > script into a single dictionary. > Here is the output, given a gr.conf file in the same directory with > the contents stated below: > > [EMAIL PROTECTED] ~/proj/mddl4/test $ ./inputs.py > {

Re: IPv6 and Python

2008-05-02 Thread Giampaolo Rodola'
On 2 Mag, 21:41, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > My hosting company provides me a common IPv4 address. > > I'd like to set up my workstation (Windows XP or Linux Debian, doesn't > > really matter) to temporarily use IPv6 for trying to add such feature > > to my library (I work on b

Re: is +=1 thread safe

2008-05-02 Thread AlFire
Duncan Booth wrote: [...] is equivalent to: x = x.__iadd__(1) thx all for answers and hints ... Generating hundreds of threads is, BTW, a very good way to get poor performance on any system. Don't do that. Create a few threads and put the actions for those threads into a Queue. If

unified command line args, environment variables, .conf file settings.

2008-05-02 Thread smitty1e
Just a fun exercise to unify some of the major input methods for a script into a single dictionary. Here is the output, given a gr.conf file in the same directory with the contents stated below: [EMAIL PROTECTED] ~/proj/mddl4/test $ ./inputs.py {'source_db': '/home/sweet/home.db'} [EMAIL PROTECTED

Boost::Python - Question about object ownership and lifetime

2008-05-02 Thread Stodge
Hi folks, new to Boost Python and struggling to build a prototype at work. I thought I'd start with a conceptual question to help clarify my understanding. I already have a basic prototype working nicely but I'm having a few issues, which I may post about later. A brief functional rundown of what

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Ben Finney
"D'Arcy J.M. Cain" <[EMAIL PROTECTED]> writes: > On Sat, 03 May 2008 00:43:02 +1000 > Ben Finney <[EMAIL PROTECTED]> wrote: > > Roy Smith <[EMAIL PROTECTED]> writes: > > > Have you ever shipped software to a customer? > > > > Yes, and all parties have been quite happy with the results. > > When

Re: RegEx for matching brackets

2008-05-02 Thread NevilleDNZ
On May 2, 11:13 am, George Sakkis <[EMAIL PROTECTED]> wrote: > [1]http://en.wikipedia.org/wiki/Context-free_language > [2]http://en.wikipedia.org/wiki/Regular_language > [3]http://wiki.python.org/moin/LanguageParsing Thanx for the link to these parsers. ANTLR looks interesting. Yoyo: http://www-us

Re: Why is None <= 0

2008-05-02 Thread Terry Reedy
"Aaron Watters" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] |What's up with Tim Peters anyway? I haven't seen much from him for a while. I miss him too ;-) He occasionally responds to tracker or pydev math issues where his unique knowledge and experience is really needed. (As

HTTP Error code Info

2008-05-02 Thread Alok Kumar
Hi I could get the HTTP error code using try: .. except: .. else: block. Is there any better way to get the HTTP Error code using urllib2 lib. Something like know the exact response number (200, 404 etc) without the above block. Regards Alok Kumar -- http://mail.python.org/mailman/listinfo/pyt

python-list@python.org

2008-05-02 Thread Gabriel Genellina
En Fri, 02 May 2008 18:39:36 -0300, Larry Bates <[EMAIL PROTECTED]> escribió: No real reason to get shutil involved in this. ...except memory usage; shutil.copyfileobj reads the input in chunks, but your version reads the whole file in memory. Depending on the file sizes, this might be a

Re: 'property' builtin does not work for me

2008-05-02 Thread Christian Heimes
Alex Fainshtein schrieb: > As you see, getter works properly. But when assigning to property, setter is > not called, as I would expect. prop is simply replaced with whatever is > assigned and ceased being a property. properties work only for new style classes. You have to subclass your class from

Re: 'property' builtin does not work for me

2008-05-02 Thread Gabriel Genellina
En Fri, 02 May 2008 18:29:57 -0300, Alex Fainshtein <[EMAIL PROTECTED]> escribió: Question: what I am doing wrong? Here, I am defining class with property member: class Test: def getter(self): print "Getter called." return 'a' def setter(self, val): print "Se

Re: portable /dev/null

2008-05-02 Thread Brendan Miller
On Fri, 02 May 2008 21:41:36 +0200, Christian Heimes wrote: > Brendan Miller schrieb: >> Hi, >> >> I have functions that take a file object and write to it. In some cases I >> just want to throw out what is written to that file object. I want >> something like open('/dev/null', 'w'), but portable

Re: Combining several files

2008-05-02 Thread Gabriel Genellina
En Fri, 02 May 2008 17:45:57 -0300, CRAIG DALTON <[EMAIL PROTECTED]> escribió: I'm looking to append several text files in one director and out put the combined files into another director. I'm new to Python and just can't get it to work. So far I've been able to create a file in the desire

python-list@python.org

2008-05-02 Thread Larry Bates
CRAIG DALTON wrote: Hi, I'm looking to append several text files in one director and out put the combined files into another director. I'm new to Python and just can't get it to work. So far I've been able to create a file in the desired directory but it isn't pulling any of the data in the

'property' builtin does not work for me

2008-05-02 Thread Alex Fainshtein
Question: what I am doing wrong? Here, I am defining class with property member: class Test: def getter(self): print "Getter called." return 'a' def setter(self, val): print "Setter called." prop = property(getter, setter) Then testing it: >>> t = Test() >>

Re: Help with pyserial and sending binary data?

2008-05-02 Thread Gabriel Genellina
En Fri, 02 May 2008 16:50:46 -0300, Rich <[EMAIL PROTECTED]> escribió: I am working on a python library for sending and receiving data from a Subaru's ECU (the fuel injection computer) via the OBD-II port and an OBD to USB cable, with the Subaru Select Monitor protocol. There are a #---

Re: how to pass C++ object to another C++ function via Python function

2008-05-02 Thread Gabriel Genellina
En Fri, 02 May 2008 00:26:38 -0300, grbgooglefan <[EMAIL PROTECTED]> escribió: On Apr 22, 7:54 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: If you have a C function that receives a PyCObject, just include the   relevant headers (cobject.h) and you can retrieve the original pointer   us

Re: creating a list from a inconsistent text file

2008-05-02 Thread Kam-Hung Soh
On Fri, 02 May 2008 23:47:11 +1000, Jetus <[EMAIL PROTECTED]> wrote: On May 2, 7:19 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: On Fri, 02 May 2008 04:14:47 -0700, Jetus wrote: > I have a comma delimited file that is separated by comma's, and then > sometimes by "," > c:\temp\05-06

python-list@python.org

2008-05-02 Thread CRAIG DALTON
Hi, I'm looking to append several text files in one director and out put the combined files into another director. I'm new to Python and just can't get it to work. So far I've been able to create a file in the desired directory but it isn't pulling any of the data in the originating directory.

Re: Finally had to plonk google gorups.

2008-05-02 Thread Mensanator
On May 2, 2:57 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On May 2, 1:18 pm, Mensanator <[EMAIL PROTECTED]> wrote: > > > On May 2, 9:53 am, Michael Torrie <[EMAIL PROTECTED]> wrote: > > > > Shawn Milochik wrote: > > > > How does one "plonk" stuff from Google Groups? Specifically, how > > > > ca

Re: Finally had to plonk google gorups.

2008-05-02 Thread Mensanator
On May 2, 2:26 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > Mensanator <[EMAIL PROTECTED]> writes: > > On May 2, 1:20 pm, Michael Torrie <[EMAIL PROTECTED]> wrote: > >> Mensanator wrote: > >> > On May 2, 9:53 am, Michael Torrie <[EMAIL PROTECTED]> wrote: > >> >> Shawn Milochik wrote: > >> >>>

Re: list.index crashes when the element is not found

2008-05-02 Thread TkNeo
On May 2, 3:09 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On May 2, 3:04 pm, TkNeo <[EMAIL PROTECTED]> wrote: > > > > > On May 2, 1:58 pm, Nick J Chackowsky <[EMAIL PROTECTED]> > > wrote: > > > > TkNeo wrote: > > > > WHAT ? > > > > > This is crazy > > > > Crazy like a fox? > > > > a = [1, 2, 3]

Re: list.index crashes when the element is not found

2008-05-02 Thread TkNeo
On May 2, 2:49 pm, Jeff <[EMAIL PROTECTED]> wrote: > The generally used idiom for that is: > > lst = ['a', 'b', 'c'] > if 'a' in lst: > foo = lst.index('a') Jeff - Gracias !! I am fairly new to python. Thanks for the example code snippet above. It is the same amount of code as receiving -1 and

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Robert Kern
Yves Dorfsman wrote: On UNIX, some people use #!/usr/bin/env python While other use #!/usr/bin/python Why is one preferred over the other one ? Caveat: I've only read *most* of this thread, so maybe someone else has already made the following point. It depends on the context. Ultimately, w

Re: is +=1 thread safe

2008-05-02 Thread Paul Rubin
Hrvoje Niksic <[EMAIL PROTECTED]> writes: > Since the += operator is not compiled into a single bytecode > instruction, it needs the lock. Aha, you are right. What I was remembering is that xrange.next is atomic in CPython, i.e. you can say something like counter = xrange(1) and the

Re: list.index crashes when the element is not found

2008-05-02 Thread George Sakkis
On May 2, 3:04 pm, TkNeo <[EMAIL PROTECTED]> wrote: > On May 2, 1:58 pm, Nick J Chackowsky <[EMAIL PROTECTED]> > wrote: > > > > > TkNeo wrote: > > > WHAT ? > > > > This is crazy > > > Crazy like a fox? > > > a = [1, 2, 3] > > try: > > a.index(99) > > except: > > a.append(99) > > finally:

Re: my module and unittest contend over commandline options...

2008-05-02 Thread chrisber
On May 2, 4:54 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > chrisber<[EMAIL PROTECTED]> wrote: > > ...it leaves me > > wonderfing whether there would have been another clean way to allow > > both my test code and unittest to have options without interfering > > with one another. > > You can pass a

Re: Why is None <= 0

2008-05-02 Thread Aaron Watters
On Apr 25, 8:17 pm, Jon Ribbens <[EMAIL PROTECTED]> wrote: > On 2008-04-25, Martin v. Löwis <[EMAIL PROTECTED]> wrote: > > > None is smaller than anything. > > According to Tim Peters, this is not true. > > See http://bugs.python.org/issue1673405 This is unfortunate. I would advocate something li

Re: Finally had to plonk google gorups.

2008-05-02 Thread George Sakkis
On May 2, 1:18 pm, Mensanator <[EMAIL PROTECTED]> wrote: > On May 2, 9:53 am, Michael Torrie <[EMAIL PROTECTED]> wrote: > > > Shawn Milochik wrote: > > > How does one "plonk" stuff from Google Groups? Specifically, how > > > can this be done in Gmail? > > > Set up a filter that looks for some phras

Help with pyserial and sending binary data?

2008-05-02 Thread Rich
Hello, I am working on a python library for sending and receiving data from a Subaru's ECU (the fuel injection computer) via the OBD-II port and an OBD to USB cable, with the Subaru Select Monitor protocol. There are a few open source programs that do this already (http://romraider.com/ , http:

Re: where do I begin with web programming in python?

2008-05-02 Thread CM
On May 2, 10:18 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On May 2, 10:07 am, bvidinli <[EMAIL PROTECTED]> wrote: > > > > > i also asked same question in this list last week. > > i foundhttp://www.cherrypy.org/tobe most suitable for me. > > it is basic, easy, pure... > > it contains its

Re: Do you know of a much simpler way of writing a program that writes a program?

2008-05-02 Thread Jeff
Use lisp? -- http://mail.python.org/mailman/listinfo/python-list

Re: Non-blocking connect

2008-05-02 Thread Jean-Paul Calderone
On Fri, 02 May 2008 14:38:47 -0400, Roy Smith <[EMAIL PROTECTED]> wrote: In article <[EMAIL PROTECTED]>, mp <[EMAIL PROTECTED]> wrote: Thanks Roy. I was just trying to understand someone else's code, but in the end it turns out that this was just a bug. What weirded me out was how injecting a

Re: list.index crashes when the element is not found

2008-05-02 Thread Jeff
The generally used idiom for that is: lst = ['a', 'b', 'c'] if 'a' in lst: foo = lst.index('a') -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and SOAP status

2008-05-02 Thread Jeff
Twisted has SOAP support. -- http://mail.python.org/mailman/listinfo/python-list

Re: Do you know of a much simpler way of writing a program that writes a program?

2008-05-02 Thread George Sakkis
On May 2, 10:40 am, Stefan Behnel <[EMAIL PROTECTED]> wrote: > mcse jung wrote: > > Here is asample program that writes a program and then executes it. > > Do you knowof a much simpler way of writing a program that writes a program? > > I'm not quite sure what you are trying to achieve here, but I

Re: Searching and replacing text ?

2008-05-02 Thread Jeff
If you know that, for instance, every occurrence of '[[' needs to be replaced with ']]', then it is much faster to use regular string methods. If you have the text stored in the variable foo: foo = foo.replace('[[', '[').replace(']]', ']').replace('->', '') If you need to recognize the actual pa

Re: IPv6 and Python

2008-05-02 Thread Christian Heimes
Giampaolo Rodola' schrieb: > I'm not sure if this is a question about python programming, system > administration or sockets in general... > I have the FTP server in my signature to which I'd want to add IPv6 > support. > My hosting company provides me a common IPv4 address. > I'd like to set up my

Re: portable /dev/null

2008-05-02 Thread Gabriel Genellina
En Fri, 02 May 2008 16:20:04 -0300, Brendan Miller <[EMAIL PROTECTED]> escribió: I have functions that take a file object and write to it. In some cases I just want to throw out what is written to that file object. I want something like open('/dev/null', 'w'), but portable. It needs to have a

Re: portable /dev/null

2008-05-02 Thread Martin v. Löwis
> I have functions that take a file object and write to it. In some cases I > just want to throw out what is written to that file object. I want > something like open('/dev/null', 'w'), but portable. > > It needs to have an underlying file descriptor/file handle, as it will be > passed to non pyth

Re: Python and SOAP status

2008-05-02 Thread Heikki Toivonen
Sorry, suds link should have been https://fedorahosted.org/suds -- Heikki Toivonen -- http://mail.python.org/mailman/listinfo/python-list

Re: IPv6 and Python

2008-05-02 Thread Martin v. Löwis
> My hosting company provides me a common IPv4 address. > I'd like to set up my workstation (Windows XP or Linux Debian, doesn't > really matter) to temporarily use IPv6 for trying to add such feature > to my library (I work on both Windows XP and Linux). > Could someone point me to some resources

Python and SOAP status

2008-05-02 Thread Heikki Toivonen
I have started researching the Python SOAP (and web services in general) options out there. Python 2.5 should be supported. I used Python for some web services stuff (demo quality) a few years back without major problems. However, it seems many of the libraries I remember from that time have becom

Re: portable /dev/null

2008-05-02 Thread Christian Heimes
Brendan Miller schrieb: > Hi, > > I have functions that take a file object and write to it. In some cases I > just want to throw out what is written to that file object. I want > something like open('/dev/null', 'w'), but portable. import os null = open(os.devnull, "wb") :) Christian -- http://

Re: IPv6 and Python

2008-05-02 Thread Mike Driscoll
On May 2, 2:15 pm, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > I'm not sure if this is a question about python programming, system > administration or sockets in general... > I have the FTP server in my signature to which I'd want to add IPv6 > support. > My hosting company provides me a commo

Re: portable /dev/null

2008-05-02 Thread Giampaolo Rodola'
On 2 Mag, 21:20, Brendan Miller <[EMAIL PROTECTED]> wrote: > Hi, > > I have functions that take a file object and write to it. In some cases I > just want to throw out what is written to that file object. I want > something like open('/dev/null', 'w'), but portable. > > It needs to have an underlyi

Re: Finally had to plonk google gorups.

2008-05-02 Thread Arnaud Delobelle
Mensanator <[EMAIL PROTECTED]> writes: > On May 2, 1:20 pm, Michael Torrie <[EMAIL PROTECTED]> wrote: >> Mensanator wrote: >> > On May 2, 9:53 am, Michael Torrie <[EMAIL PROTECTED]> wrote: >> >> Shawn Milochik wrote: >> >>> How does one "plonk" stuff from Google Groups? Specifically, how >> >>> ca

Re: list.index crashes when the element is not found

2008-05-02 Thread Larry Bates
TkNeo wrote: On May 2, 1:58 pm, Nick J Chackowsky <[EMAIL PROTECTED]> wrote: TkNeo wrote: WHAT ? This is crazy Crazy like a fox? a = [1, 2, 3] try: a.index(99) except: a.append(99) finally: print a.index(99) MY question: which exception should I actually be catching there? **

Re: Searching and replacing text ?

2008-05-02 Thread Larry Bates
Oltmans wrote: Hi, I'm new to Python (and admittedly not a very good programmer) and I've come across a scenario where I've to search and replace text in a file. For the sake of an example, I'm searching for every occurence of the text [[http://www.hotmail.com -> Hotmail]] I've to replace it w

portable /dev/null

2008-05-02 Thread Brendan Miller
Hi, I have functions that take a file object and write to it. In some cases I just want to throw out what is written to that file object. I want something like open('/dev/null', 'w'), but portable. It needs to have an underlying file descriptor/file handle, as it will be passed to non python code

IPv6 and Python

2008-05-02 Thread Giampaolo Rodola'
I'm not sure if this is a question about python programming, system administration or sockets in general... I have the FTP server in my signature to which I'd want to add IPv6 support. My hosting company provides me a common IPv4 address. I'd like to set up my workstation (Windows XP or Linux Debia

Re: list.index crashes when the element is not found

2008-05-02 Thread Nick J Chackowsky
TkNeo wrote: On May 2, 1:58 pm, Nick J Chackowsky <[EMAIL PROTECTED]> wrote: TkNeo wrote: WHAT ? This is crazy Crazy like a fox? a = [1, 2, 3] try: a.index(99) except: a.append(99) finally: print a.index(99) MY question: which exception should I actually be catching there? **

Re: Searching and replacing text ?

2008-05-02 Thread Gabriel Genellina
En Fri, 02 May 2008 15:51:42 -0300, Oltmans <[EMAIL PROTECTED]> escribió: Hi, I'm new to Python (and admittedly not a very good programmer) and I've come across a scenario where I've to search and replace text in a file. For the sake of an example, I'm searching for every occurence of the te

Re: list.index crashes when the element is not found

2008-05-02 Thread Jerry Hill
On Fri, May 2, 2008 at 3:04 PM, TkNeo <[EMAIL PROTECTED]> wrote: > ofcouse try catch is going to work but in ideality the index function > should return a -1 and no way in hell crash. It doesn't crash. It raises an exception. This is a pretty fundamental concept of python programming. If you

Re: pil:effbot and pythonware offline

2008-05-02 Thread Mike Driscoll
On May 1, 5:15 pm, spdegabrielle <[EMAIL PROTECTED]> wrote: > Sorry, I'm new to python and was trying to get imageTK; > this led me to try find PIL, but pythonware and effbot both seem to be > offline. > > I can't find any mention of an outage on python.org, this newsgroup, > or the planet-blogs. >

Re: Finally had to plonk google gorups.

2008-05-02 Thread Mensanator
On May 2, 1:20 pm, Michael Torrie <[EMAIL PROTECTED]> wrote: > Mensanator wrote: > > On May 2, 9:53 am, Michael Torrie <[EMAIL PROTECTED]> wrote: > >> Shawn Milochik wrote: > >>> How does one "plonk" stuff from Google Groups? Specifically, how > >>> can this be done in Gmail? > >> Set up a filter t

Re: list.index crashes when the element is not found

2008-05-02 Thread TkNeo
On May 2, 1:58 pm, Nick J Chackowsky <[EMAIL PROTECTED]> wrote: > TkNeo wrote: > > WHAT ? > > > This is crazy > > Crazy like a fox? > > a = [1, 2, 3] > try: > a.index(99) > except: > a.append(99) > finally: > print a.index(99) > > MY question: which exception should I actually be cat

Re: list.index crashes when the element is not found

2008-05-02 Thread Gabriel Genellina
En Fri, 02 May 2008 15:25:13 -0300, TkNeo <[EMAIL PROTECTED]> escribió: WHAT ? This is crazy crashes? Or raises a ValueError exception, which is perfectly normal? -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: list.index crashes when the element is not found

2008-05-02 Thread Nick J Chackowsky
TkNeo wrote: WHAT ? This is crazy Crazy like a fox? a = [1, 2, 3] try: a.index(99) except: a.append(99) finally: print a.index(99) MY question: which exception should I actually be catching there? ** Posted from http://www.teranews.com ** -- http://mail.python.org/mailman/listinf

Re: SSL through python. possible ?

2008-05-02 Thread Mike Driscoll
On May 2, 1:20 pm, Heikki Toivonen <[EMAIL PROTECTED]> wrote: > Mike Driscoll wrote: > > On Apr 29, 8:56 am, TkNeo <[EMAIL PROTECTED]> wrote: > >> I need to do SSL file transfer using python? Is there a library i can > >> use ? > > >http://sandbox.rulemaker.net/ngps/m2/ > > M2Crypto has since moved

Searching and replacing text ?

2008-05-02 Thread Oltmans
Hi, I'm new to Python (and admittedly not a very good programmer) and I've come across a scenario where I've to search and replace text in a file. For the sake of an example, I'm searching for every occurence of the text [[http://www.hotmail.com -> Hotmail]] I've to replace it with [http://www.h

Re: i want to add a timeout to my code

2008-05-02 Thread Gabriel Genellina
En Thu, 01 May 2008 17:06:20 -0300, maehhheeyy <[EMAIL PROTECTED]> escribió: On Apr 29, 3:29 pm, John Krukoff <[EMAIL PROTECTED]> wrote: On Tue, 2008-04-29 at 14:47 -0700, maehhheeyy wrote: > On Apr 17, 4:24 pm, Miki <[EMAIL PROTECTED]> wrote: > > On Apr 17, 1:10 pm,maehhheeyy<[EMAIL PROTECTED]

Re: Pyserial - send and receive characters through linux serial port

2008-05-02 Thread terry
On May 2, 10:26 am, terry <[EMAIL PROTECTED]> wrote: > On Apr 26, 8:21 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > > > > > > > On 2008-04-25, terry <[EMAIL PROTECTED]> wrote: > > > > I am trying to send a character to '/dev/ttyS0' and expect the > > > same character and upon receipt I want to se

Re: SSL through python. possible ?

2008-05-02 Thread Giampaolo Rodola'
On 29 Apr, 15:56, TkNeo <[EMAIL PROTECTED]> wrote: > I need to do SSL file transfer using python? Is there a library i can > use ? > > Thanks. If you have patience you can wait for Python 2.6 which will include a new ssl module, otherwise there are a lot of third party libraries out there which al

Re: Non-blocking connect

2008-05-02 Thread Roy Smith
In article <[EMAIL PROTECTED]>, mp <[EMAIL PROTECTED]> wrote: > Thanks Roy. I was just trying to understand someone else's code, but > in the end it turns out that this was just a bug. > > What weirded me out was how injecting a print statement preventing the > error from occurring, but now I g

Re: Do you know of a much simpler way of writing a program that writes a program?

2008-05-02 Thread Erik Max Francis
mcse jung wrote: Here is asample program that writes a program and then executes it. Do you knowof a much simpler way of writing a program that writes a program? It looks like you have a program which is more printed text than program logic. In which case, the usual solution is to use a tem

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Erik Max Francis
Ben Finney wrote: No, because it's quite common for the PATH variable to have '/usr/local/bin' appear *before* both of '/bin' and '/usr/bin'. If the system has a sysadmin-installed '/usr/local/bin/python' installed as well as the OS-installed '/usr/bin/python', then the two shebang options the

list.index crashes when the element is not found

2008-05-02 Thread TkNeo
WHAT ? This is crazy -- http://mail.python.org/mailman/listinfo/python-list

Re: is +=1 thread safe

2008-05-02 Thread Arnaud Delobelle
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: > > There are no modern processors with an opcode for incrementing a memory > location!? At least my C64 can do that. ;-) Indeed! I remember a simple use was to make the border change colour very fast, a v. cool effect when you're 12!

Re: calling variable function name ?

2008-05-02 Thread TkNeo
On Apr 30, 11:05 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > TkNeo<[EMAIL PROTECTED]> writes: > > > George - Thanks for your reply but what you suggested is not working: > > > def FA(param1,param2): > > print "FA" + param1 + " " + param2 > > def FA(param1,param2): > > print "FB" + par

Re: Non-blocking connect

2008-05-02 Thread mp
Thanks Roy. I was just trying to understand someone else's code, but in the end it turns out that this was just a bug. What weirded me out was how injecting a print statement preventing the error from occurring, but now I get it. Without blocking, the connection handshake occurs in parallel after

Re: SSL through python. possible ?

2008-05-02 Thread Heikki Toivonen
Mike Driscoll wrote: > On Apr 29, 8:56 am, TkNeo <[EMAIL PROTECTED]> wrote: >> I need to do SSL file transfer using python? Is there a library i can >> use ? > > http://sandbox.rulemaker.net/ngps/m2/ M2Crypto has since moved to http://chandlerproject.org/Projects/MeTooCrypto -- Heikki Toivone

Re: Finally had to plonk google gorups.

2008-05-02 Thread Michael Torrie
Mensanator wrote: > On May 2, 9:53 am, Michael Torrie <[EMAIL PROTECTED]> wrote: >> Shawn Milochik wrote: >>> How does one "plonk" stuff from Google Groups? Specifically, how >>> can this be done in Gmail? >> Set up a filter that looks for some phrase in the mail headers that >> identifies messages

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Carl Banks
On May 2, 11:07 am, "D'Arcy J.M. Cain" <[EMAIL PROTECTED]> wrote: > On Sat, 03 May 2008 00:43:02 +1000 > > Ben Finney <[EMAIL PROTECTED]> wrote: > > Roy Smith <[EMAIL PROTECTED]> writes: > > > Have you ever shipped software to a customer? > > > Yes, and all parties have been quite happy with the re

Re: Non-blocking connect

2008-05-02 Thread Roy Smith
In article <[EMAIL PROTECTED]>, mp <[EMAIL PROTECTED]> wrote: > Code is at bottom. Basically, if I turn off socket blocking prior to > connecting, I get a "Socket is not connected" error when I try to send > data. However, if I do not turn off blocking, OR if I place a print > statement anywhere

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Thorsten Kampe
* Ben Finney (Sat, 03 May 2008 00:37:45 +1000) > Thorsten Kampe <[EMAIL PROTECTED]> writes: > > * Ben Finney (Fri, 02 May 2008 23:30:01 +1000) > > > The OP was asking why people prefer on over the other. My answer > > > is that I prefer specifying "give me the default OS Python" > > > because anyth

Re: Preventing 'bad' filenames from raising errors in os.path

2008-05-02 Thread Martin v. Löwis
> Now, I can understand if you don't like the "WindowsError" as that is > obviously platform specific. The try/except pattern however is the way > errors are handled in python and the best and most appropriate way to > deal with it. The above example just shows that at the very least > there isn't

Re: pygame.key.get_pressed[K_a], K_a is not defined!?

2008-05-02 Thread Mike Driscoll
On May 2, 12:03 pm, globalrev <[EMAIL PROTECTED]> wrote: > print pygame.K_a displays 97 btw. what does that mean? i though it > would return true or false or 0 or 1. That's probably the key code value. Or the ASCII representation for the key. You'd have to read the pygame docs to really know. Mik

Re: pygame.key.get_pressed[K_a], K_a is not defined!?

2008-05-02 Thread Patrick Mullen
The K_a is a constant integer, but you don't need to worry about it's value. It tells you the index in get_pressed() to check for. So: print pygame.key.get_pressed()[pygame.K_a] Says, look at the 97th index in the get_pressed() list and see if that is a 1 or a 0. Or if you use the pygame event

Re: Pyserial - send and receive characters through linux serial port

2008-05-02 Thread terry
On Apr 26, 8:21 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-04-25, terry <[EMAIL PROTECTED]> wrote: > > > I am trying to send a character to '/dev/ttyS0' and expect the > > same character and upon receipt I want to send another > > character. I tired withPyserialbut in vain. > > Pyserial

Re: Preventing 'bad' filenames from raising errors in os.path

2008-05-02 Thread Matimus
On May 2, 9:40 am, [EMAIL PROTECTED] wrote: > Bad file names, i.e. filenames the OS considers illegal, will cause > functions in the os.path module to raise an error. > > Example: > > import os.path > print os.path.getsize( 'c:/pytest/*.py' ) > > On Windows XP using Python 2.5.2 I get the following

Re: Finally had to plonk google gorups.

2008-05-02 Thread Mensanator
On May 2, 9:53 am, Michael Torrie <[EMAIL PROTECTED]> wrote: > Shawn Milochik wrote: > > How does one "plonk" stuff from Google Groups? Specifically, how > > can this be done in Gmail? > > Set up a filter that looks for some phrase in the mail headers that > identifies messages originating from goo

Non-blocking connect

2008-05-02 Thread mp
Code is at bottom. Basically, if I turn off socket blocking prior to connecting, I get a "Socket is not connected" error when I try to send data. However, if I do not turn off blocking, OR if I place a print statement anywhere before the send call, it works! WTF? I'd like to understand what's goin

Re: pygame.key.get_pressed[K_a], K_a is not defined!?

2008-05-02 Thread globalrev
print pygame.K_a displays 97 btw. what does that mean? i though it would return true or false or 0 or 1. -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to store config or preferences in a multi-platform way.

2008-05-02 Thread Carl Banks
On May 2, 12:30 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Thu, 01 May 2008 10:30:03 -0300, Nick Craig-Wood <[EMAIL PROTECTED]> > escribió: > > > As for where to store it, I use os.path.expanduser("~") to find the > > base directory and a bit of platform specific code. > > > Something

Preventing 'bad' filenames from raising errors in os.path

2008-05-02 Thread python
Bad file names, i.e. filenames the OS considers illegal, will cause functions in the os.path module to raise an error. Example: import os.path print os.path.getsize( 'c:/pytest/*.py' ) On Windows XP using Python 2.5.2 I get the following traceback: Traceback (most recent call last): File "",

Re: pygame.key.get_pressed[K_a], K_a is not defined!?

2008-05-02 Thread globalrev
On 2 Maj, 18:13, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > globalrev schrieb: > > > if pygame.key.get_pressed[K_a]: > > print "Muppet" > > > K_a is not defined. > > > but yes it is. why do i get this error? > > No it isn't - otherwise you wouldn't get this error, wouldn't you? > >

Re: Python 2.6 and wrapping C libraries on Windows

2008-05-02 Thread Gabriel Genellina
En Thu, 01 May 2008 09:09:21 -0300, Christian Heimes <[EMAIL PROTECTED]> escribió: illume schrieb: Has anyone tested the new python binaries that link to msvcr90.dll on win9x machines? It doesn't matter to use because Python 2.6 and 3.0 require at least Windows 2000 SP4. The 9x, ME and NT s

Re: Best way to store config or preferences in a multi-platform way.

2008-05-02 Thread Gabriel Genellina
En Thu, 01 May 2008 10:30:03 -0300, Nick Craig-Wood <[EMAIL PROTECTED]> escribió: As for where to store it, I use os.path.expanduser("~") to find the base directory and a bit of platform specific code. Something like this snippet self.is_windows = sys.platform == 'win32' self.home =

  1   2   >