Re: is +=1 thread safe

2008-05-02 Thread Marc 'BlackJack' Rintsch
On Thu, 01 May 2008 15:33:09 -0700, Gary Herron wrote: > Of course it's not thread safe. For the same reason and more basic, > even the expression i++ is not thread safe in C++. > > Any such calculation, on modern processors, requires three operations: > retrieve value of i into a register,

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

2008-05-02 Thread bvidinli
i also asked same question in this list last week. i found http://www.cherrypy.org/ to be most suitable for me. it is basic, easy, pure... it contains its own webserver, very easy to start. others have many framworks, structures, classes many many.. i wanted a pure web programming system , i found

Re: is +=1 thread safe

2008-05-02 Thread Paul Rubin
AlFire <[EMAIL PROTECTED]> writes: > But I still can not believe that +=1 is not a thread safe operation. In CPython I believe it is thread safe, because of the global interpreter lock. Thread switches can happen only between bytecode executions, not in the middle of a bytecode, even though execu

Re: is +=1 thread safe

2008-05-02 Thread Duncan Booth
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Thu, 01 May 2008 15:33:09 -0700, Gary Herron wrote: > >> Of course it's not thread safe. For the same reason and more basic, >> even the expression i++ is not thread safe in C++. >> >> Any such calculation, on modern processors, require

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

2008-05-02 Thread Jeroen Ruigrok van der Werven
-On [20080502 07:51], Ben Finney ([EMAIL PROTECTED]) wrote: >To my mind, the Python interpreter installed by a package as >distributed with the OS *is* OS territory and belongs in /usr/bin/. That's the difference with a distribution, such as Linux, and full OSes , such as BSDs or comm

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

2008-05-02 Thread Duncan Booth
Yves Dorfsman <[EMAIL PROTECTED]> wrote: > On UNIX, some people use > #!/usr/bin/env python > > While other use > #!/usr/bin/python > > Why is one preferred over the other one ? > I don't think the answers so far have communicated what I believe to be the important point: it isn't that one is

Re: help with list comprehension

2008-05-02 Thread George Sakkis
On May 2, 2:17 am, Matimus <[EMAIL PROTECTED]> wrote: > On May 1, 10:50 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > > On May 1, 11:46 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > > > > Yves Dorfsman wrote: > > > > > In the following script, m1() and m2() work fine. I am assuming m2() is

Re: is +=1 thread safe

2008-05-02 Thread Hrvoje Niksic
Paul Rubin writes: > AlFire <[EMAIL PROTECTED]> writes: >> But I still can not believe that +=1 is not a thread safe operation. > > In CPython I believe it is thread safe, because of the global > interpreter lock. Thread switches can happen only between bytecode > execu

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

2008-05-02 Thread 7stud
On May 1, 3:25 pm, jmDesktop <[EMAIL PROTECTED]> wrote: > I have been to the main python site, but am still confused.  I have > been using .net, so it may be obvious how to do this to everyone > else.  I am aware there are various frameworks (Django, Pylons, etc.), > but I would like to know how to

Re: Simple TK Question - refreshing the canvas when not in focus

2008-05-02 Thread Eric Brunel
On Wed, 30 Apr 2008 20:19:32 +0200, blaine <[EMAIL PROTECTED]> wrote: On Apr 30, 10:41 am, Peter Otten <[EMAIL PROTECTED]> wrote: blaine wrote: > Still doesn't work. I'm looking into using wx instead... > This is the full code - does it work for anyone else? Just do a echo > 'line 0 0 10 10'

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

2008-05-02 Thread Duncan Booth
chrisber <[EMAIL PROTECTED]> wrote: > I've poked around to see if I could delete the options my earlier code > consumed from the commandline buffer, before invoking unittest, but > that seems klugy. Instead, I hardwired in a testing config file name, > that always has to be local. That works pret

get number that is raised to the power of

2008-05-02 Thread Astan Chee
Hi, Im not sure if this is more of a math question or a python question. I have a variable in python: >>> v = 10.0**n is there a way to find the value of n if i know only v aside from str(v).split('+')[1] ? that seems like too much of a hack and I was wondering if there was a faster way of doi

Re: Python's doc problems: sort

2008-05-02 Thread George Neuner
On Wed, 30 Apr 2008 12:35:10 +0200, "John Thingstad" <[EMAIL PROTECTED]> wrote: >PÃ¥ Wed, 30 Apr 2008 06:26:31 +0200, skrev George Sakkis ><[EMAIL PROTECTED]>: > >> >>\|||/ >> (o o) >> ,ooO--(_)---. >> | Please| >> | don't feed the | >> | TROLL's !

Re: get number that is raised to the power of

2008-05-02 Thread Marc 'BlackJack' Rintsch
On Fri, 02 May 2008 19:19:07 +1000, Astan Chee wrote: > Hi, > Im not sure if this is more of a math question or a python question. I > have a variable in python: > >>> v = 10.0**n > is there a way to find the value of n if i know only v aside from > str(v).split('+')[1] ? that seems like too mu

Re: get number that is raised to the power of

2008-05-02 Thread Python.Arno
On 2 mei 2008, at 11:19, Astan Chee wrote: Hi, Im not sure if this is more of a math question or a python question. I have a variable in python: >>> v = 10.0**n is there a way to find the value of n if i know only v aside from str(v).split('+')[1] ? that seems like too much of a hack and I

Python documentation

2008-05-02 Thread admin
Hello, I have been learning python for some time using the dive into python book. I am interested to know if anyone can recommend a book which covers more advanced topics like threading and potentially GUI style coding. Regards, Ronald -- http://mail.python.org/mailman/listinfo/python-list

Re: dropping win98 support? was Re: Python 2.6 and wrapping C libraries on Windows

2008-05-02 Thread illume
On May 2, 8:37 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "illume" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > | Ah, why is that? > > Were any of the reasons given inhttp://www.python.org/dev/peps/pep-0011/ > unclear? > It appears you are already aware of MS's non-support

Re: no cleanup on TERM signal

2008-05-02 Thread Laszlo Nagy
Yves Dorfsman wrote: I did a few tests with this script: class byebye: def __del__(self): print 'Bye, bye...' x = byebye() x.del() gets executed if: -I del x, then run gc.collect() -simply exit the script -get the script to abort on an exception But if I kill it with the default sign

Re: get number that is raised to the power of

2008-05-02 Thread Astan Chee
Python.Arno wrote: the "reverse" of a power to is logarithm so v = 10**n <=> math.log(v,10) = n Arno Im so ashamed of myself for not thinking in logs. I must be dreaming again. Thanks for the help. -- "Formulations of number theory: Complete, Consistent, Non-trivial. Choose two." Animal

Re: get number that is raised to the power of

2008-05-02 Thread Boris Borcic
Marc 'BlackJack' Rintsch wrote: On Fri, 02 May 2008 19:19:07 +1000, Astan Chee wrote: Hi, Im not sure if this is more of a math question or a python question. I have a variable in python: >>> v = 10.0**n is there a way to find the value of n if i know only v aside from str(v).split('+')[1]

Re: dropping win98 support? was Re: Python 2.6 and wrapping C libraries on Windows

2008-05-02 Thread Christian Heimes
illume schrieb: > There are still *lots* of people who still use win95, 98, 98se, me, > and win2k - as shown by the statistics I linked to in a previous > post. If you want more statistics about the number of people using > what OS they are fairly easy to find with a search engine. One day > win9

Re: no cleanup on TERM signal

2008-05-02 Thread Christian Heimes
Laszlo Nagy schrieb: > For sensitive resources, instead of writing __del__ methods, you should > create a "close()" method. Python does this with file objects, DB API > 2.0 with database connection objects etc. Then you can do > > res = create_resource() > try: >use_resource() > finally: >

creating a list from a inconsistent text file

2008-05-02 Thread Jetus
I have a comma delimited file that is separated by comma's, and then sometimes by "," c:\temp\05-06-08\Sale1,659 CECIL,"659 CECIL,40211", 1,659,CECIL,AVENUE,LOUISVILLE,40211,"$65,276.78 " c:\temp\05-06-08\Sale2,637 SOUTH 27TH,"637 SOUTH 27TH,40211", 2,637,SOUTH 27TH,STREET,LOUISVILLE,40211,"$45,45

Re: creating a list from a inconsistent text file

2008-05-02 Thread Marc 'BlackJack' Rintsch
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-08\Sale1,659 CECIL,"659 CECIL,40211", > 1,659,CECIL,AVENUE,LOUISVILLE,40211,"$65,276.78 " > c:\temp\05-06-08\Sale2,637 SOUTH 27TH,"637 SOUTH

Re: portable fork+exec/spawn

2008-05-02 Thread Nick Craig-Wood
Brendan Miller <[EMAIL PROTECTED]> wrote: > On Fri, 02 May 2008 13:25:55 +1000, Ben Finney wrote: > > > URL:http://docs.python.org/lib/module-subprocess.html > > Awesome. This is exactly what I was hoping existed. subprocess works well for spawn process, send input, receive output, read exit c

Re: Custom Classes?

2008-05-02 Thread J. Clifford Dyer
On Thu, 2008-05-01 at 17:31 -0500, Victor Subervi wrote: > On Wed, Apr 30, 2008 at 12:35 PM, J. Cliff Dyer <[EMAIL PROTECTED]> wrote: > Post working code, and I'll answer your actual question. > > Good grief! The code is *not* double spaced! Take a look. Click to > the end of the first li

Re: no cleanup on TERM signal

2008-05-02 Thread Duncan Booth
Christian Heimes <[EMAIL PROTECTED]> wrote: >> res = create_resource() >> try: >>use_resource() >> finally: >>res.close() # Must free resource, but the object can still be >>alive... > > You can replace the try/finally code with a "with resource: > do_something()" block if the object

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

2008-05-02 Thread Ben Finney
Jeroen Ruigrok van der Werven <[EMAIL PROTECTED]> writes: > -On [20080502 07:51], Ben Finney ([EMAIL PROTECTED]) wrote: > >To my mind, the Python interpreter installed by a package as > >distributed with the OS *is* OS territory and belongs in /usr/bin/. > > T

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

2008-05-02 Thread D'Arcy J.M. Cain
On Fri, 02 May 2008 15:50:22 +1000 Ben Finney <[EMAIL PROTECTED]> wrote: > > You have lived a sheltered life. Not every packaging system puts the > > executible in /usr/bin. Many systems use /usr/local/bin. > > They use that for the operating-system-installed default Python > interpreter? Colour

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

2008-05-02 Thread Ben Finney
"D'Arcy J.M. Cain" <[EMAIL PROTECTED]> writes: > On Fri, 02 May 2008 13:24:01 +1000 > Ben Finney <[EMAIL PROTECTED]> wrote: > > I much prefer "#! /usr/bin/python" because I want my Python > > programs to, by default, be run with the default Python, and > > depend on Python being installed by the o

Re: Python documentation

2008-05-02 Thread Mike Driscoll
On May 2, 4:34 am, [EMAIL PROTECTED] wrote: > Hello, > > I have been learning python for some time using the dive into python > book. I am interested to know if anyone can recommend a book which > covers more advanced topics like threading and potentially GUI style > coding. > > Regards, > > Ronald

Re: Custom Classes?

2008-05-02 Thread Victor Subervi
Thank you for your patience. I apologize for so many errors. Also, apparently your email client renders those double-spaces whereas mine does not. Hopefully the below is better: #!/usr/bin/python import MySQLdb import sys,os sys.path.append(os.getcwd()) from login import login user, passwd, db, h

Re: creating a list from a inconsistent text file

2008-05-02 Thread Jetus
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-08\Sale1,659 CECIL,"659 CECIL,40211", > > 1,659,CECIL,AVENUE,LO

Re: is +=1 thread safe

2008-05-02 Thread Diez B. Roggisch
Duncan Booth schrieb: Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: On Thu, 01 May 2008 15:33:09 -0700, Gary Herron wrote: Of course it's not thread safe. For the same reason and more basic, even the expression i++ is not thread safe in C++. Any such calculation, on modern processor

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

2008-05-02 Thread Thorsten Kampe
* 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 > anything not installed by the OS is to non-standardised for me to > worry about. > > Others may prefer something

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

2008-05-02 Thread Nicola Musatti
On May 2, 3:50 pm, mcse jung <[EMAIL PROTECTED]> 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? Use a templating engine, such as Cheetah: http://www.cheetahtemplate.org/ Cheers, Nicola Mus

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

2008-05-02 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Ben Finney <[EMAIL PROTECTED]> wrote: > Whereas if Python is *not* installed from an OS package, it's up to > the sys admin to ensure that it works -- not up to my program. So I > don't see the point in making it work by default, when what I want for > my program i

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

2008-05-02 Thread D'Arcy J.M. Cain
On Fri, 02 May 2008 23:30:01 +1000 Ben Finney <[EMAIL PROTECTED]> wrote: > 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 > anything not installed by the OS is to non-standardised for me to > worry about. As so

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

2008-05-02 Thread [EMAIL PROTECTED]
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/to be most suitable for me. > it is basic, easy, pure... > it contains its own webserver, very easy to start. > > others have many framworks, structures, cla

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

2008-05-02 Thread mcse jung
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? """ - Name:_writePythonCode.py Purpose: This script writes Pyt

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

2008-05-02 Thread Torsten Bronger
Hallöchen! D'Arcy J.M. Cain writes: > On Fri, 02 May 2008 23:30:01 +1000 > Ben Finney <[EMAIL PROTECTED]> wrote: > >> 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 anything not installed by the OS is to n

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

2008-05-02 Thread Ben Finney
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 anything not installed by the OS is to non-standardised > > f

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

2008-05-02 Thread Grant Edwards
On 2008-05-02, Ben Finney <[EMAIL PROTECTED]> wrote: > The specified command takes the form of a fully-qualified file > path, and zero or one arguments to the program. That command > is then executed by the kernel, and the Python program file is > passed as input to the resulting process. Just to

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

2008-05-02 Thread Stefan Behnel
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 bet there is a simpler way to do it than by generating a script. You

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

2008-05-02 Thread Ben Finney
Roy Smith <[EMAIL PROTECTED]> writes: > In article <[EMAIL PROTECTED]>, > Ben Finney <[EMAIL PROTECTED]> wrote: > > > Whereas if Python is *not* installed from an OS package, it's up > > to the sys admin to ensure that it works -- not up to my program. > > So I don't see the point in making it w

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

2008-05-02 Thread Ben Finney
"D'Arcy J.M. Cain" <[EMAIL PROTECTED]> writes: > On Fri, 02 May 2008 23:30:01 +1000 > Ben Finney <[EMAIL PROTECTED]> wrote: > > 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 anything not installed by the

Re: creating a list from a inconsistent text file

2008-05-02 Thread Mike Kent
On May 2, 9:47 am, Jetus <[EMAIL PROTECTED]> wrote: > Hello Marc; > Thanks for the input! I am worried about the comma in the "" data > items, how do I tell Python to look for the "" data first, then use > the comma separator? Marc has already given you the correct answer. You really should read

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

2008-05-02 Thread Grant Edwards
On 2008-05-02, Jeroen Ruigrok van der Werven <[EMAIL PROTECTED]> wrote: >>I've never clearly understood why people want to use "#! /usr/bin/env >>python", which is prone to finding a different Python from the one >>installed by the operating system. I'd be interested to see what >>responses are in

Re: portable fork+exec/spawn

2008-05-02 Thread Jean-Paul Calderone
On Fri, 02 May 2008 06:30:03 -0500, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: Brendan Miller <[EMAIL PROTECTED]> wrote: On Fri, 02 May 2008 13:25:55 +1000, Ben Finney wrote: > URL:http://docs.python.org/lib/module-subprocess.html Awesome. This is exactly what I was hoping existed. subproc

Re: Getting started with pyvtk

2008-05-02 Thread Peter Pearson
On Thu, 01 May 2008 16:45:51 -0500, Robert Kern <[EMAIL PROTECTED]> wrote: > > pyvtk is not the Python interface to VTK. It is for the > creation of VTK files. The vtk(1) command is a Tcl shell > with the VTK libraries loaded (I believe). Read the VTK > documentation for information on the Tcl in

Re: creating a list from a inconsistent text file

2008-05-02 Thread Diez B. Roggisch
Jetus schrieb: 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-08\Sale1,659 CECIL,"659 CECIL,40211", 1,659,CECIL,AVENUE,LOU

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

2008-05-02 Thread Grant Edwards
On 2008-05-02, Jeroen Ruigrok van der Werven <[EMAIL PROTECTED]> wrote: > -On [20080502 07:51], Ben Finney ([EMAIL PROTECTED]) wrote: >>To my mind, the Python interpreter installed by a package as >>distributed with the OS *is* OS territory and belongs in /usr/bin/. > >

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

2008-05-02 Thread D'Arcy J.M. Cain
On Fri, 02 May 2008 16:26:51 +0200 Torsten Bronger <[EMAIL PROTECTED]> wrote: > > Certainly #! /usr/bin/python is fine if you never expect your > > software to run outside of your own little corner of the world but > > you asked why people prefer the env version and the answer is that > > we want t

Re: Finally had to plonk google gorups.

2008-05-02 Thread Michael Torrie
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 google groups. Gmail's filters are fairly flexible. I'd probably just hav

Re: Cookie Confusion - How to Set a Cookie

2008-05-02 Thread Aaron Watters
On May 1, 9:02 am, [EMAIL PROTECTED] wrote: > On Apr 29, 3:35 pm, Aaron Watters <[EMAIL PROTECTED]> wrote: > > > > > > Thanks for the code, Aaron. I will give it a try. > > > > I've been reading some more about cookielib and am not sure whether I > > > should use Cookie or cookielib. This is what

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

2008-05-02 Thread Torsten Bronger
Hallöchen! D'Arcy J.M. Cain writes: > On Fri, 02 May 2008 16:26:51 +0200 > Torsten Bronger <[EMAIL PROTECTED]> wrote: > >>> Certainly #! /usr/bin/python is fine if you never expect your >>> software to run outside of your own little corner of the world >>> but you asked why people prefer the env

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

2008-05-02 Thread D'Arcy J.M. Cain
On Sat, 03 May 2008 00:44:00 +1000 Ben Finney <[EMAIL PROTECTED]> wrote: > "D'Arcy J.M. Cain" <[EMAIL PROTECTED]> writes: > > As someone else pointed out, not all the world is Linux. > > It's a good thing I've never implied such to be the case. You haven't *said* it but you have definitely *impli

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

2008-05-02 Thread D'Arcy J.M. Cain
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 some of us talk about shipping software we aren't talking about

Re: no cleanup on TERM signal

2008-05-02 Thread Laszlo Nagy
You can replace the try/finally code with a "with resource: do_something()" block if the object supporst the context manager protocol. I'm using 2.4 so... If you want to run some code during the shutdown phase of the Python process you can register a callback function in the "atexit" module

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

2008-05-02 Thread Grant Edwards
On 2008-05-02, D'Arcy J.M. Cain <[EMAIL PROTECTED]> wrote: > On Sat, 03 May 2008 00:44:00 +1000 > Ben Finney <[EMAIL PROTECTED]> wrote: >> "D'Arcy J.M. Cain" <[EMAIL PROTECTED]> writes: >> > As someone else pointed out, not all the world is Linux. >> >> It's a good thing I've never implied such to

Re: help with list comprehension

2008-05-02 Thread Yves Dorfsman
George Sakkis wrote: Another alternative is: from operator import itemgetter def m3(): colours, nums = zip(*map(itemgetter('colour','num'), l)) It's slower than m1() but faster than m2(); it's also the most concise, especially if you extract more than two keys. Good you guys gave me som

Re: Getting started with pyvtk

2008-05-02 Thread Paul Melis
Peter Pearson wrote: On Thu, 01 May 2008 16:45:51 -0500, Robert Kern <[EMAIL PROTECTED]> wrote: pyvtk is not the Python interface to VTK. It is for the creation of VTK files. The vtk(1) command is a Tcl shell with the VTK libraries loaded (I believe). Read the VTK documentation for information

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

2008-05-02 Thread globalrev
if pygame.key.get_pressed[K_a]: print "Muppet" K_a is not defined. but yes it is. why do i get this error? this works: if pygame.key.get_pressed(): print "donkey" -- http://mail.python.org/mailman/listinfo/python-list

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

2008-05-02 Thread Yves Dorfsman
Thanks everybody, I didn't mean to start a flamewar... I do get it now, it's whatever python is in the path, vs. the specific one you're pointing to. 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'.

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

2008-05-02 Thread Diez B. Roggisch
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? What IS defined is pygame.K_a Or if you do from pygame import K_a then K_a is defi

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 =

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: 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? > >

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: 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

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

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: 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

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: 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: 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: 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: 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: #!/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: 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 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: 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: 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: 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: 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: 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!

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: #!/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

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: 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: 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: 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: 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]

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: 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

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: 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 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: 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: 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. >

  1   2   >