Looking for a tool to checkfor python script backward compatibility

2009-07-12 Thread Baptiste Lepilleur
I'm looking for a tool that could be used in a pre-commit step to check that only features available in a "old" python version are used, say python 2.3 for example. Does any one know of one ? -- http://mail.python.org/mailman/listinfo/python-list

Re: 2.4 VS 3.1 for simple print

2009-07-12 Thread Ben Finney
Lawrence D'Oliveiro writes: > In message <87hbxkm7n2@benfinney.id.au>, Ben Finney wrote: > > > For this and other differences introduced in the Python 3.x series, see > > http://www.python.org/dev/peps/pep-3100/>. > > People never thank you for an "RTFM" response. It's a good thing I avoid

PyODE

2009-07-12 Thread Virgil Stokes
Does anyone have PyODE running on Python 2.6.2? --V -- http://mail.python.org/mailman/listinfo/python-list

Re: Implementing a cache

2009-07-12 Thread skip
Nikolaus> I want to implement a caching data structure in Python that Nikolaus> allows me to: Nikolaus> 1. Quickly look up objects using a key Nikolaus> 2. Keep track of the order in which the objects are accessed Nikolaus> (most recently and least recently accessed one,

Re: Implementing a cache

2009-07-12 Thread pdpi
On Jul 12, 2:01 pm, s...@pobox.com wrote: >     Nikolaus> I want to implement a caching data structure in Python that >     Nikolaus> allows me to: > >     Nikolaus>  1. Quickly look up objects using a key >     Nikolaus>  2. Keep track of the order in which the objects are accessed >     Nikolaus>

Re: Looking for a tool to checkfor python script backward compatibility

2009-07-12 Thread Jean-Paul Calderone
On Sun, 12 Jul 2009 09:47:32 +0200, Baptiste Lepilleur wrote: I'm looking for a tool that could be used in a pre-commit step to check that only features available in a "old" python version are used, say python 2.3 for example. Does any one know of one ? Run your test suite with whichever ver

how to run the "main" section of another module ?

2009-07-12 Thread Stef Mientki
hello, when I''m working in a library, and want to test some of the library functions, I need to switch to a main application, (which has a normal main-section) and run that. If the library is simply, I add a main section to the library, so no problem. But if the library requires a lot of over

Re: Implementing a cache

2009-07-12 Thread skip
>> My Cache module does #1 and #3.  I'm not sure if you want #2 for >> internal cache maintenance or for as part of the API. >> >>    http://www.smontanaro.net/python/Cache.py pdpi> I'm not sure whether #2 is doable at all, as written. You _need_ a pdpi> complete history

Re: how to run the "main" section of another module ?

2009-07-12 Thread Stef Mientki
Stef Mientki wrote: hello, when I''m working in a library, and want to test some of the library functions, I need to switch to a main application, (which has a normal main-section) and run that. If the library is simply, I add a main section to the library, so no problem. But if the library r

Re: how to run the "main" section of another module ?

2009-07-12 Thread Aahz
In article , Stef Mientki wrote: > >when I''m working in a library, and want to test some of the library >functions, I need to switch to a main application, (which has a normal >main-section) and run that. if __name__ == '__main__': main() Then you can call main() from another module for te

Re: how to run the "main" section of another module ?

2009-07-12 Thread Piet van Oostrum
> Stef Mientki (SM) wrote: >SM> Stef Mientki wrote: >>> hello, >>> >>> when I''m working in a library, >>> and want to test some of the library functions, >>> I need to switch to a main application, >>> (which has a normal main-section) >>> and run that. >>> >>> If the library is simply, >

multiprocessing and dictionaries

2009-07-12 Thread Bjorn Meyer
I am trying to convert a piece of code that I am using the thread module with to the multiprocessing module. The way that I have it set up is a chunk of code reads a text file and assigns a dictionary key multiple values from the text file. I am using locks to write the values to the dictionary

Re: how to run the "main" section of another module ?

2009-07-12 Thread Stef Mientki
SM> if __name__ == '__main__': SM>import db_test SM>new_globals = {} SM>new_globals [ '__name__' ] = '__main__' SM>new_globals [ '__file__' ] = 'not really valuable' SM>execfile ( 'db_test.py', new_globals ) Why not: import db_test db_test.main() I think that is what

Re: how to run the "main" section of another module ?

2009-07-12 Thread Aahz
In article , Stef Mientki wrote: >Stef deleted an attribution: >> >> Why not: >> >> import db_test >> db_test.main() > >Yes I tried that too, but it gives the following error: "module object >not callable" You need to create a main() function in db_test first. -- Aahz (a...@pythoncraft.com)

Re: how to run the "main" section of another module ?

2009-07-12 Thread Emile van Sebille
On 7/12/2009 11:13 AM Stef Mientki said... SM> if __name__ == '__main__': SM>import db_test SM>new_globals = {} SM>new_globals [ '__name__' ] = '__main__' SM>new_globals [ '__file__' ] = 'not really valuable' SM>execfile ( 'db_test.py', new_globals ) Why not: implie

Question about generators

2009-07-12 Thread Cameron Pulsford
Hey everyone, I have this small piece of code that simply finds the factors of a number. import sys def factor(n): primes = (6*i+j for i in xrange(1, n) for j in [1, 5] if (i+j)%5 ! = 0) factors = [] for i in [2, 3, 5]: while n % i == 0: n /= i f

Sockets and threading

2009-07-12 Thread zayatzz
Im trying to get aquinted to python on bit more basic level and am following socket and threading programming tutorials from these 2 addresses : http://heather.cs.ucdavis.edu/~matloff/Python/PyNet.pdf http://heather.cs.ucdavis.edu/~matloff/Python/PyThreads.pdf in this PyThreads file he sets up th

MySQLdb + SSH Tunnel

2009-07-12 Thread Riley Crane
OVERVIEW: I am running a script on one machine that connects to a MySQL database on another machine that is outside of our university's domain. According to the administrator, network policies do not allow the compute nodes to access machines outside of our university's domain. COMPUTERS: A = comp

Re: MySQLdb + SSH Tunnel

2009-07-12 Thread Emile van Sebille
On 7/12/2009 12:18 PM Riley Crane said... OVERVIEW: I am running a script on one machine that connects to a MySQL database on another machine that is outside of our university's domain. According to the administrator, network policies do not allow the compute nodes to access machines outside of o

Re: Question about generators

2009-07-12 Thread Mensanator
On Jul 12, 2:11 pm, Cameron Pulsford wrote: > Hey everyone, I have this small piece of code that simply finds the   > factors of a number. > > import sys > > def factor(n): >      primes = (6*i+j for i in xrange(1, n) for j in [1, 5] if (i+j)%5 ! > = 0) > >      factors = [] > >      for i in [2,

Re: Question about generators

2009-07-12 Thread Vilya Harvey
2009/7/12 Cameron Pulsford : > My question is, is it possible to combine those two loops? The primes > generator I wrote finds all primes up to n, except for 2, 3 and 5, so I must > check those explicitly. Is there anyway to concatenate the hard coded list > of [2,3,5] and the generator I wrote so

Re: need to write a assembly progrm

2009-07-12 Thread Rhodri James
On Sat, 11 Jul 2009 05:17:18 +0100, Dennis Lee Bieber wrote: On Fri, 10 Jul 2009 13:25:49 +0100, "Rhodri James" declaimed the following in gmane.comp.python.general: On Thu, 09 Jul 2009 11:52:44 +0100, m.reddy prasad reddy wrote: > my aim is to run the assembly programs in python.by that

Re: Question about generators

2009-07-12 Thread Piet van Oostrum
> Cameron Pulsford (CP) wrote: >CP> Hey everyone, I have this small piece of code that simply finds the >CP> factors of a number. Others have already given you advice to add the [2, 3, 5] to the iterator (of which the primes.extend([2,3,5]) will not work). Please allow me to make some other

Re: Sockets and threading

2009-07-12 Thread Gabriel Genellina
En Sun, 12 Jul 2009 16:16:29 -0300, zayatzz escribió: while 1: k = self.myclntsock.recv(1) if k == "": break srvr.vlock.acquire() srvr.v += k srvr.vlock.releas

Webcam + GStreamer

2009-07-12 Thread Sparky
Hello! I need to stream from a webcam in Linux and I need to be able to analyze the video feed frame by frame with PIL. Currently my web- cam (Quickcam Chat) only seems to work with GStreamer so a solution using pygst would be preferred. Thanks for your help, Sam -- http://mail.python.org/mailman

Re: Sockets and threading

2009-07-12 Thread Piet van Oostrum
> zayatzz (z) wrote: >z> Im trying to get aquinted to python on bit more basic level and am >z> following socket and threading programming tutorials from these 2 >z> addresses : >z> http://heather.cs.ucdavis.edu/~matloff/Python/PyNet.pdf >z> http://heather.cs.ucdavis.edu/~matloff/Python/PyTh

Re: Webcam + GStreamer

2009-07-12 Thread Sparky
On Jul 12, 3:50 pm, Sparky wrote: > Hello! I need to stream from a webcam in Linux and I need to be able > to analyze the video feed frame by frame with PIL. Currently my web- > cam (Quickcam Chat) only seems to work with GStreamer so a solution > using pygst would be preferred. > > Thanks for you

c++ Source Code for acm 2004-2005 problems

2009-07-12 Thread Davood Vahdati
Dear Sirs And Madams : it is an Acm programming competition Questions in year 2004-2005 . could you please solve problems is question ? I Wan't C++ Source Code program About this questions OR Problems . thank you for your prompt attention to this matter your faithfully. -

Re: Webcam + GStreamer

2009-07-12 Thread David
Sparky wrote: On Jul 12, 3:50 pm, Sparky wrote: Hello! I need to stream from a webcam in Linux and I need to be able to analyze the video feed frame by frame with PIL. Currently my web- cam (Quickcam Chat) only seems to work with GStreamer so a solution using pygst would be preferred. Thanks f

Re: c++ Source Code for acm 2004-2005 problems

2009-07-12 Thread Paul McGuire
On Jul 12, 5:24 pm, Davood Vahdati wrote: > Dear Sirs And Madams : > > it is an Acm programming competition Questions in year 2004-2005 . > could you please solve problems is question ? I  Wan't C++ Source Code > program About this questions OR Problems . thank you for your prompt > attention to t

Re: c++ Source Code for acm 2004-2005 problems

2009-07-12 Thread Gabriel Genellina
En Sun, 12 Jul 2009 19:24:57 -0300, Davood Vahdati escribió: it is an Acm programming competition Questions in year 2004-2005 . could you please solve problems is question ? I Wan't C++ Source Code program About this questions OR Problems . thank you for your prompt attention to this matter

Re: multiprocessing and dictionaries

2009-07-12 Thread Chris Rebert
On Sun, Jul 12, 2009 at 10:16 AM, Bjorn Meyer wrote: > I am trying to convert a piece of code that I am using the thread module with > to the multiprocessing module. > > The way that I have it set up is a chunk of code reads a text file and assigns > a dictionary key multiple values from the text f

Re: Webcam + GStreamer

2009-07-12 Thread Sparky
On Jul 12, 4:30 pm, David wrote: > Sparky wrote: > > On Jul 12, 3:50 pm, Sparky wrote: > >> Hello! I need to stream from a webcam in Linux and I need to be able > >> to analyze the video feed frame by frame with PIL. Currently my web- > >> cam (Quickcam Chat) only seems to work with GStreamer so

Re: shutil.rmtree raises "OSError: [Errno 39] Directory not empty" exception

2009-07-12 Thread Sean DiZazzo
On Jul 10, 5:10 pm, Tim Chase wrote: > >      shutil.rmtree(filename) > >    File "/usr/lib64/python2.5/shutil.py", line 178, in rmtree > >      onerror(os.rmdir, path, sys.exc_info()) > >    File "/usr/lib64/python2.5/shutil.py", line 176, in rmtree > >      os.rmdir(path) > > OSError: [Errno 39]

Re: Question about generators

2009-07-12 Thread Terry Reedy
Cameron Pulsford wrote: When you start a new thread, you should start a new thread and not piggyback on an existing thread. -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about generators

2009-07-12 Thread Cameron Pulsford
itertools.chain() did it, thanks! As far as the primes generator, it does not generate any non-primes. All primes (except 2, 3 and 5) are in the form (6*x + 1, 6*x + 5) where is x is [1, 2, ..., n]. The only time it doesn't generate a prime is when x + (1 or 5) % 5 == 0. Which is what that

Re: Webcam + GStreamer

2009-07-12 Thread David
Sparky wrote: On Jul 12, 4:30 pm, David wrote: Sparky wrote: On Jul 12, 3:50 pm, Sparky wrote: Hello! I need to stream from a webcam in Linux and I need to be able to analyze the video feed frame by frame with PIL. Currently my web- cam (Quickcam Chat) only seems to work with GStreamer so a

Re: Question about generators

2009-07-12 Thread John Machin
On Jul 13, 11:24 am, Cameron Pulsford wrote: > As far as the primes generator, it does not generate any non-primes.   > All primes (except 2, 3 and 5) are in the form (6*x + 1, 6*x + 5)   > where is x is [1, 2, ..., n]. The only time it doesn't generate a   > prime is when x + (1 or 5) % 5 == 0.

Re: Question about generators

2009-07-12 Thread David Robinow
On Sun, Jul 12, 2009 at 9:24 PM, Cameron Pulsford wrote: > As far as the primes generator, it does not generate any non-primes. All > primes (except 2, 3 and 5) are in the form (6*x + 1, 6*x + 5) where is x is > [1, 2, ..., n]. The only time it doesn't generate a prime is when x + (1 or > 5) % 5 ==

Re: Webcam + GStreamer

2009-07-12 Thread Sparky
On Jul 12, 7:38 pm, David wrote: > Sparky wrote: > > On Jul 12, 4:30 pm, David wrote: > >> Sparky wrote: > >>> On Jul 12, 3:50 pm, Sparky wrote: > Hello! I need to stream from a webcam in Linux and I need to be able > to analyze the video feed frame by frame with PIL. Currently my web-

Re: Question about generators

2009-07-12 Thread Cameron Pulsford
I read it on the haskell site in their sieves/prime wheel section, I guess I misunderstood something. (east to do over there...) I did verify it against established list of primes and other generators I've written that use more normal methods, but I only hand verified it. It is at least int

Re: Question about generators

2009-07-12 Thread John Machin
On Jul 13, 1:17 pm, Cameron Pulsford wrote: > I read it on the haskell site in their sieves/prime wheel section, I   > guess I misunderstood something. (east to do over there...) I did   > verify it against established list of primes and other generators I've   > written that use more normal metho

Infinite loops and synchronization

2009-07-12 Thread Vincent Gulinao
lst = list() (lst populated by async twisted deferred callbacks) while True: if len(lst) == SOME_NUMBER: return lst Q1: is this a common OK practice? I'm worried infinite loops hogs memory. Q2: operating on list from threads (mostly appends) must be safe, right (synchroni

compilation problem of python on AIX 6.1

2009-07-12 Thread Amit
Hello I want to intsall python on my AIX 6.1 Box. I couldn't get any rpm for python 2.5.x for AIX 6.1. THen I decided to compile python 2.5.4 on my AIX box. I downloaded the python source code from www.python.org and tried to compile on my AIX both using gcc. step 1 ./configure --with-gcc config