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 giving such responses, then. (Pointing someone
to the specific document isn't “RTFM”.)

-- 
 \ “Leave nothing to chance. Overlook nothing. Combine |
  `\  contradictory observations. Allow yourself enough time.” |
_o__) —Hippocrates |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


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, not a
Nikolaus> complete history)
Nikolaus>  3. Quickly retrieve and remove the least recently accessed
Nikolaus> object.

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

Skip
-- 
http://mail.python.org/mailman/listinfo/python-list


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>     (most recently and least recently accessed one, not a
>     Nikolaus>     complete history)
>     Nikolaus>  3. Quickly retrieve and remove the least recently accessed
>     Nikolaus>     object.
>
> 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
>
> Skip

I'm not sure whether #2 is doable at all, as written. You _need_ a
complete history (at least the full ordering of the items in the
cache) to be able to tell what the least recently used item is.
-- 
http://mail.python.org/mailman/listinfo/python-list


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 versions of Python you want to support.

Tools like Hudson () and BuildBot
() can help with this.

Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list


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 overhead,
I want to run some main program,
that has a main section,
and uses my library under construction.

So how do I call from within the library module,
in a main section in that library module,
a main in another module ?

thanks,
Stef Mientki
--
http://mail.python.org/mailman/listinfo/python-list


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 (at least the full ordering of the items in the
pdpi> cache) to be able to tell what the least recently used item is.

I should have added that my Cache module does maintain a history.  (Clearly
it needs that to determine the LRU item.)  It is exposed as part of the API
via the ftimes method.

S
-- 
http://mail.python.org/mailman/listinfo/python-list


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 requires a lot of overhead,
I want to run some main program,
that has a main section,
and uses my library under construction.

So how do I call from within the library module,
in a main section in that library module,
a main in another module ?

thanks,
Stef Mientki


btw,
I just found this in one of my programs (which works but isn't very 
beautiful)


In the library fill under construction I put this main section:
(sb_test.py is the main program, that has a main section and uses the 
library under construction)


if __name__ == '__main__':
   import db_test
   new_globals = {}
   new_globals [ '__name__' ] = '__main__'
   new_globals [ '__file__' ] = 'not really valuable'
   execfile ( 'db_test.py', new_globals )


--
http://mail.python.org/mailman/listinfo/python-list


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 testing purposes.
-- 
Aahz (a...@pythoncraft.com)   <*> http://www.pythoncraft.com/

"If you think it's expensive to hire a professional to do the job, wait
until you hire an amateur."  --Red Adair
-- 
http://mail.python.org/mailman/listinfo/python-list


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,
>>> I add a main section to the library,
>>> so no problem.
>>> 
>>> But if the library requires a lot of overhead,
>>> I want to run some main program,
>>> that has a main section,
>>> and uses my library under construction.
>>> 
>>> So how do I call from within the library module,
>>> in a main section in that library module,
>>> a main in another module ?
>>> 
>>> thanks,
>>> Stef Mientki

>SM> btw,
>SM> I just found this in one of my programs (which works but isn't very
>SM> beautiful)

>SM> In the library fill under construction I put this main section:
>SM> (sb_test.py is the main program, that has a main section and uses the
>SM> library under construction)

>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 Aahz meant.

-- 
Piet van Oostrum 
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
-- 
http://mail.python.org/mailman/listinfo/python-list


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.
The way that the values are written is as follows:
mydict.setdefault(key, []).append(value)

The problem that I have run into is that using multiprocessing, the key gets 
set, but the values don't get appended.
I've even tried the Manager().dict() option, but it doesn't seem to work.

Is this not supported at this time or am I missing something?

Thanks in advance.

Bjorn
-- 
http://mail.python.org/mailman/listinfo/python-list


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 Aahz meant.

  

Yes I tried that too,
but it gives the following error:
"module object not callable"


db_text.__main__()
gives error:
'module' object has no attribute '__main__'

cheers,
Stef

--
http://mail.python.org/mailman/listinfo/python-list


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)   <*> http://www.pythoncraft.com/

"If you think it's expensive to hire a professional to do the job, wait
until you hire an amateur."  --Red Adair
-- 
http://mail.python.org/mailman/listinfo/python-list


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:


implied here is that you restructure...



import db_test
db_test.main()

I think that is what Aahz meant.

  

Yes I tried that too,
but it gives the following error:
"module object not callable"


db_text.__main__()
gives error:
'module' object has no attribute '__main__'



You see, we're further assuming you've structured the module for this 
purpose.  IOW, your module should end with:


if __name__ == '__main__':
main()

and nothing more.  Then, you can do:

import db_test
db_test.main()

Emile

--
http://mail.python.org/mailman/listinfo/python-list


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
factors.append(i)
for i in primes:
while n % i == 0:
n /= i
factors.append(i)
print factors

factor(int(sys.argv[1]))

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 that I don't need  
two for loops that do the same thing?


I tried writing a primes function using yield statements, but it  
didn't work like I thought it would.

--
http://mail.python.org/mailman/listinfo/python-list


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 threaded server app which listens to
what clients send to it and echos it back to clients while adding sent
info into one string.

The problem is that the code does not work for me.

class srvr(threading.Thread):
v = ""
vlock = threading.Lock()
id = 0
def __init__(self,clntsock):
threading.Thread.__init__(self)
self.myid = srvr.id
srvr.id += 1
self.myclntsock = clntsock
def run(self):
while 1:
k = self.myclntsock.recv(1)
if k == "": break
srvr.vlock.acquire()
srvr.v += k
srvr.vlock.release()
self.myclntsock.send(srvr.v)
self.myclntsock.close()

Instead of sendint back i get this error :
  File "server3.py", line 31, in serveclient
k = self.myclntsock.recv(1)
  File "/usr/lib/python2.6/socket.py", line 165, in _dummy
raise error(EBADF, 'Bad file descriptor')
socket.error: [Errno 9] Bad file descriptor

As much as i understand this line 31 is supposed to recieve stuff from
clients and has buffer size 1. I dont understand what this has to do
with file descriptor.. whatever that is anyway.

Alan
-- 
http://mail.python.org/mailman/listinfo/python-list


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 = compute node within university (I do not have shell access)
B = 2nd machine within university that does not block outside
connections (I have root access)
C = machine outside of university (I have root access)
mysqldb on A cannot connect to C but.
mysqldb on A can connect to B

WHAT I WOULD LIKE TO DO:
Is it possible to set something up where A talks to a port on B, and
that port is actually nothing more than 3306 on C?  Can I do this with
an SSH tunnel?

Can anyone please give precise instructions?
-- 
http://mail.python.org/mailman/listinfo/python-list


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 our university's domain.

COMPUTERS:
A = compute node within university (I do not have shell access)
B = 2nd machine within university that does not block outside
connections (I have root access)


...so B can talk to C presumably...


C = machine outside of university (I have root access)
mysqldb on A cannot connect to C but.
mysqldb on A can connect to B






WHAT I WOULD LIKE TO DO:
Is it possible to set something up where A talks to a port on B, and
that port is actually nothing more than 3306 on C?  Can I do this with
an SSH tunnel?

Can anyone please give precise instructions?


ssh with something like...

ssh -lroot -L3306:C:3306 B

Watch out for other instances of mysql on A or B...

Emile


--
http://mail.python.org/mailman/listinfo/python-list


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, 3, 5]:
>          while n % i == 0:
>              n /= i
>              factors.append(i)
>      for i in primes:
>          while n % i == 0:
>              n /= i
>              factors.append(i)
>      print factors
>
> factor(int(sys.argv[1]))
>
> My question is, is it possible to combine those two loops?

Yeah, get rid of the first loop.

> 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 that I don't need  
> two for loops that do the same thing?

primes.extend([2,3,5])

>
> I tried writing a primes function using yield statements, but it  
> didn't work like I thought it would.

-- 
http://mail.python.org/mailman/listinfo/python-list


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 that I don't need two for loops that
> do the same thing?

itertools.chain([2, 3, 5], primes) is what you're looking for, I think.

Vil.
-- 
http://mail.python.org/mailman/listinfo/python-list


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 we can use  
that

> in
> the any labs.because we can run the python in the mobiles also.if we
> write
> assembly programs in the mobile ,the mobile act as a tool kit for the
> lab.tell me any other solutions for this

Please define what you mean by "assembly".


The poorly punctuated paragraph sounds, to me, as if they mean they
want (Windows assumed) EXE files that can be dropped onto remote/laptop
machines without performing a full installation of Python...

But yes... "assembly programs" does, to me, also mean things
containing mnemonics for machine level opcodes.


Given that to me, "assembly programs" does not mean .EXE files at all,
not even a little bit, I'm prefering to refuse to guess :-)

--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list


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

>CP> import sys

>CP> def factor(n):
>CP> primes = (6*i+j for i in xrange(1, n) for j in [1, 5] if (i+j)%5 ! = 0)

It is a bit misleading to call this `primes' as it will also contain
non-primes. Of course they don't harm as they will never be considered a
factor because all their prime factors will have been successfully
removed before this non prime will be considered.

>CP> factors = []

>CP> for i in [2, 3, 5]:
>CP> while n % i == 0:
>CP> n /= i
>CP> factors.append(i)
>CP> for i in primes:
>CP> while n % i == 0:
>CP> n /= i
>CP> factors.append(i)

 You can stop the loop when n == 1. Like:
 if n == 1: break

>CP> print factors

>CP> factor(int(sys.argv[1]))

>CP> My question is, is it possible to combine those two loops? The primes
>CP> generator I wrote finds all primes up to n, except for 2, 3 and 5, so  I
>CP> must check those explicitly. Is there anyway to concatenate the hard  coded
>CP> list of [2,3,5] and the generator I wrote so that I don't need  two for
>CP> loops that do the same thing?

>CP> I tried writing a primes function using yield statements, but it  didn't
>CP> work like I thought it would.

See the recent thread `Why is my code faster with append() in a loop than with 
a large list?'
http://mail.python.org/pipermail/python-list/2009-July/718931.html
-- 
Piet van Oostrum 
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
-- 
http://mail.python.org/mailman/listinfo/python-list


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.release()
self.myclntsock.send(srvr.v)
self.myclntsock.close()

Instead of sendint back i get this error :
  File "server3.py", line 31, in serveclient
k = self.myclntsock.recv(1)
  File "/usr/lib/python2.6/socket.py", line 165, in _dummy
raise error(EBADF, 'Bad file descriptor')
socket.error: [Errno 9] Bad file descriptor

As much as i understand this line 31 is supposed to recieve stuff from
clients and has buffer size 1. I dont understand what this has to do
with file descriptor.. whatever that is anyway.


That means the clntsock variable isn't an open, available socket. Note
that you close the socket right after sending the response - are you sure
you don't have an indentation error there?

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list


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/listinfo/python-list


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/PyThreads.pdf

>z> in this PyThreads file he sets up threaded server app which listens to
>z> what clients send to it and echos it back to clients while adding sent
>z> info into one string.

>z> The problem is that the code does not work for me.

>z> class srvr(threading.Thread):
>z> v = ""
>z> vlock = threading.Lock()
>z> id = 0
>z> def __init__(self,clntsock):
>z> threading.Thread.__init__(self)
>z> self.myid = srvr.id
>z> srvr.id += 1
>z> self.myclntsock = clntsock
>z> def run(self):
>z> while 1:
>z> k = self.myclntsock.recv(1)
>z> if k == "": break
>z> srvr.vlock.acquire()
>z> srvr.v += k
>z> srvr.vlock.release()
>z> self.myclntsock.send(srvr.v)
>z> self.myclntsock.close()


The last line is wrongly indented. It should be outside the loop. Shift
it left so that it lines up with the while. 

What happens now is that the socket is closed after the first recv().
Then the next round in the loop fails because the myclntsock is closed.

-- 
Piet van Oostrum 
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
-- 
http://mail.python.org/mailman/listinfo/python-list


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 your help,
> Sam

Sorry, to clarify I am just having a hard time capturing frames in a
way that I can access with PIL.
-- 
http://mail.python.org/mailman/listinfo/python-list


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.
-
29th ACM International Collegiate
Sponsored by
Programming Contest, 2004-2005
Sharif Preliminary Contest
Sharif University of Technology, 28 Oct. 2004

Problem B
(Program filename: B.CPP, B.DPR, B.PAS or B.java)

Parallelogram Counting
There are n distinct points in the plane, given by their integer
coordinates. Find the number of parallelograms whose
vertices lie on these points. In other words, find the number of 4-
element subsets of these points that can be written as
{A, B, C, D} such that AB || CD, and BC || AD. No four points are in a
straight line.
Input (filename: B.IN)
The first line of the input file contains a single integer t (1 £ t £
10), the number of test cases. It is followed by the input

data for each test case.
The first line of each test case contains an integer n (1 £ n £ 1000).
Each of the next n lines, contains 2 space-separated
integers x and y (the coordinates of a point) with magnitude (absolute
value) of no more than 10.

Output (Standard Output)
Output should contain t lines.
Line i contains an integer showing the number of the parallelograms as
described above for test case i.

Sample Input
2
6
0 0
2 0
4 0
1 1
3 1
5 1
7
-2 -1
8 9
5 7
1 1
4 8
2 0
9 8

Sample Output
5
6
--
Problem B-Page 1 of 1

28th ACM International Collegiate
Sponsored by
Programming Contest, 2003-2004
Sharif Preliminary Contest
Sharif University of Technology, 14 Nov. 2003

Problem C
(Program filename: C.CPP or C.PAS or C.DPR or C.java)

Toy Storage
Mom and dad have a problem: their child, Reza, never puts his toys
away when he is finished playing with them.
They gave Reza a rectangular box to put his toys in. Unfortunately,
Reza is rebellious and obeys his parents by simply
throwing his toys into the box. All the toys get mixed up, and it is
impossible for Reza to find his favorite toys anymore.
Reza's parents came up with the following idea. They put cardboard
partitions into the box. Even if Reza keeps
throwing his toys into the box, at least toys that get thrown into
different partitions stay separate. The box looks like this
from the top:

We want for each positive integer t, such that there exists a
partition with t toys, determine how many partitions
have t, toys.
Input (filename: C.IN)
The input consists of a number of cases. The first line consists of
six integers n, m, x1, y1, x2, y2. The number of
cardboards to form the partitions is n (0< n £ 1000) and the number of
toys is given in m (0 0) of toys in a partition. The value t will be followed by a
colon and a space, followed the number of
partitions containing t toys. Output will be sorted in ascending order
of t for each box.
Sample Input
4 10 0 10 100 0
20 20
80 80
60 60
40 40
5 10
15 10
95 10
25 10
65 10
75 10
35 10
45 10
55 10
85 10
5 6 0 10 60 0

4 3
15 30
3 1
6 8
10 10
2 1
2 8
1 5
5 5
40 10
7 9
0

Sample Output
Box

2: 5
Box
1: 4
2: 1
--
29th ACM International Collegiate
Sponsored by
Programming Contest, 2004-2005
Sharif Preliminary Contest
Sharif University of Technology, 28 Oct. 2004

Problem D
(Program filename: D.CPP, D.DPR, or D.java)

Software Company
A software developing company has been assigned two programming
projects. As
both projects are within the same contract, both must be handed in at
the same
time. It does not help if one is finished earlier.

This company has n employees to do the jobs. To manage the two
projects more
easily, each is divided into m independent subprojects. Only one
employee can
work on a single subproject at one time, but it is possible for two
employees to
work on different subprojects of the same project simultaneously.

Our goal is to finish the projects as soon as possible.

Input (filename: D.IN)
The first line of the input file contains a single integer t (1 £ t £
11), the
number of test cases, followed by the input data for each test case.
The first
line of each test case contains two integers n (1 £ n £ 100), and m (1
£ m £
100). The input for this test case will be followed by n lines. Each
line
contains two integers which specify how much time in seconds it will
take for
the specified employee to complete one subproject of each project. So
if the
line contains x and y, it means that it takes the employee x seconds
to complete
a subproject from the first project, and y seconds to complete a
subproject from
the second project.
Output (Standard Output)
There should be one line per test case containing the minimum amount
of time in
seconds after which both projects can be completed.

Sample Input
1
3 

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 for your help,
Sam


Sorry, to clarify I am just having a hard time capturing frames in a
way that I can access with PIL.


Most web cams produce jpeg images so read the note at the bottom here;
http://effbot.org/imagingbook/format-jpeg.htm
What exactly are you trying to do? What have you tried so far and what 
happened may help.


--
Powered by Gentoo GNU/Linux
http://linuxcrazy.com
--
http://mail.python.org/mailman/listinfo/python-list


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 this matter
>
> 2 1
> 4 3
> 5 1
> 4 2
>


looking for the Python content in this post...

m, nope, didn't find any...

I guess the OP tried on a C++ newsgroup and got told to do his own
homework, so he came here instead?
-- 
http://mail.python.org/mailman/listinfo/python-list


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


Not C++ code but Python: A brute force approach to the first problem.


Parallelogram Counting
There are n distinct points in the plane, given by their integer
coordinates. Find the number of parallelograms whose
vertices lie on these points.


class Point:
  def __init__(self, x, y): self.x, self.y = x, y
  def __repr__(self): return 'Point(%d,%d)' % (self.x, self.y)

class Segment:
  def __init__(self, p0, p1): self.p0, self.p1 = p0, p1
  def is_parallel(self, other):
return ((self.p1.x-self.p0.x) * (other.p1.y-other.p0.y) -
(self.p1.y-self.p0.y) * (other.p1.x-other.p0.x) == 0)

points = [
Point(-2,-1),
Point(8,9),
Point(5,7),
Point(1,1),
Point(4,8),
Point(2,0),
Point(9,8)]

n = 0
for i,A in enumerate(points):
  for B in points[i+1:]:
AB = Segment(A,B)
for C in points:
  if C in (A,B): continue
  BC = Segment(B,C)
  for D in points:
if D in (A,B,C): continue
CD = Segment(C,D)
if AB.is_parallel(CD) and BC.is_parallel(Segment(A,D)):
  print A,B,C,D
  n += 1

n /= 4 # ABCD,BCDA,CDAB,DABC ## BACD etc already removed
print n

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list


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 file. I am using locks to write
> the values to the dictionary.
> The way that the values are written is as follows:
>        mydict.setdefault(key, []).append(value)
>
> The problem that I have run into is that using multiprocessing, the key gets
> set, but the values don't get appended.

Don't have much concurrency experience, but have you tried using a
defaultdict instead?
It's possible its implementation might solve the problem.
http://docs.python.org/dev/library/collections.html#collections.defaultdict

Cheers,
Chris
-- 
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


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 a solution
> >> using pygst would be preferred.
>
> >> Thanks for your help,
> >> Sam
>
> > Sorry, to clarify I am just having a hard time capturing frames in a
> > way that I can access with PIL.
>
> Most web cams produce jpeg images so read the note at the bottom 
> here;http://effbot.org/imagingbook/format-jpeg.htm
> What exactly are you trying to do? What have you tried so far and what
> happened may help.
>
> --
> Powered by Gentoo GNU/Linuxhttp://linuxcrazy.com

Dear David,

Thank you for your quick response. I have tried a few things. First of
all, I have tried gst-launch-0.10 v4l2src ! ffmpegcolorspace !
pngenc ! filesink location=foo.png. Foo.png comes out sharp enough but
it takes around 2 seconds to complete. I have also tried CVTypes but
it does not run without LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so and,
when it does run, it only displays colored "snow". Here is that code:

import pygame
import Image
from pygame.locals import *
import sys

import opencv
#this is important for capturing/displaying images
from opencv import highgui

camera = highgui.cvCreateCameraCapture(-1)
print "cam:" + str(camera)
def get_image():
print "here"
im = highgui.cvQueryFrame(camera)
#convert Ipl image to PIL image
return opencv.adaptors.Ipl2PIL(im)

fps = 30.0
pygame.init()
window = pygame.display.set_mode((320,240))
pygame.display.set_caption("WebCam Demo")
screen = pygame.display.get_surface()

while True:
events = pygame.event.get()
im = get_image()
print im.mode
pg_img = pygame.image.frombuffer(im.tostring(), im.size, im.mode)
screen.blit(pg_img, (0,0))
pygame.display.flip()
pygame.time.delay(int(1000 * 1.0/fps))

Finally, I have gotten pygst to stream video with the example at
http://pygstdocs.berlios.de/pygst-tutorial/webcam-viewer.html but of
course I do not know how to get a hold of that data. Just so you know,
I am trying a primitive type of object tracking. I would use some of
the libraries already available but the two more popular
implementations on Linux (tbeta/ccv and reacTIVision) dont seem to
work with my web cam. I have more info on those non-python attempts at
http://ubuntuforums.org/showthread.php?p=7596908. Unfortunately no one
seemed to respond to that post.

Thanks again,
Sam
-- 
http://mail.python.org/mailman/listinfo/python-list


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] Directory not empty: /path/to/my/dir
>
> > According to the documentation, shutil.rmtree should not care about  
> > directory being not empty.
>
> This sounds suspiciously like a permission issue.  rmtree()
> *should* walk the tree removing items *if it can*.  If a file
> can't be deleted, it treats it as an error.  rmtree() takes
> parameters for ignore_errors and an onerror callback function, so
> you can catch these error conditions.
>
> -tkc

This one took me a long time to find a solution for.  Check this page,
and see comment #3: http://code.activestate.com/recipes/193736/

I guess if the file is marked as "Read Only" or "Archive", or
whatever, it cannot be deleted with shutil.rmtree()

The key:  win32api.SetFileAttributes(path,
win32con.FILE_ATTRIBUTE_NORMAL)

It will work!

~Sean
-- 
http://mail.python.org/mailman/listinfo/python-list


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 last part is  
making sure doesn't happen. I'm not a mathematician or anything so  
correct me if I'm wrong, but that's what I've read.


Also sorry if this was piggy backed, I started the thread as a fresh e- 
mail to python-list@python.org, sorry if I messed something up!


On Jul 12, 2009, at 8:15 PM, Terry Reedy wrote:


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


--
http://mail.python.org/mailman/listinfo/python-list


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 solution
using pygst would be preferred.
Thanks for your help,
Sam

Sorry, to clarify I am just having a hard time capturing frames in a
way that I can access with PIL.

Most web cams produce jpeg images so read the note at the bottom 
here;http://effbot.org/imagingbook/format-jpeg.htm
What exactly are you trying to do? What have you tried so far and what
happened may help.

--
Powered by Gentoo GNU/Linuxhttp://linuxcrazy.com


Dear David,

Thank you for your quick response. I have tried a few things. First of
all, I have tried gst-launch-0.10 v4l2src ! ffmpegcolorspace !
pngenc ! filesink location=foo.png. Foo.png comes out sharp enough but
it takes around 2 seconds to complete. I have also tried CVTypes but
it does not run without LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so and,
when it does run, it only displays colored "snow". Here is that code:

import pygame
import Image
from pygame.locals import *
import sys

import opencv
#this is important for capturing/displaying images
from opencv import highgui

camera = highgui.cvCreateCameraCapture(-1)
print "cam:" + str(camera)
def get_image():
print "here"
im = highgui.cvQueryFrame(camera)
#convert Ipl image to PIL image
return opencv.adaptors.Ipl2PIL(im)

fps = 30.0
pygame.init()
window = pygame.display.set_mode((320,240))
pygame.display.set_caption("WebCam Demo")
screen = pygame.display.get_surface()

while True:
events = pygame.event.get()
im = get_image()
print im.mode
pg_img = pygame.image.frombuffer(im.tostring(), im.size, im.mode)
screen.blit(pg_img, (0,0))
pygame.display.flip()
pygame.time.delay(int(1000 * 1.0/fps))

Finally, I have gotten pygst to stream video with the example at
http://pygstdocs.berlios.de/pygst-tutorial/webcam-viewer.html but of
course I do not know how to get a hold of that data. Just so you know,
I am trying a primitive type of object tracking. I would use some of
the libraries already available but the two more popular
implementations on Linux (tbeta/ccv and reacTIVision) dont seem to
work with my web cam. I have more info on those non-python attempts at
http://ubuntuforums.org/showthread.php?p=7596908. Unfortunately no one
seemed to respond to that post.

Thanks again,
Sam

See if this gets you started, I got it working here with a video4linux2 cam.
http://code.google.com/p/python-video4linux2/
here is what I have, I think it is the same;
http://dwabbott.com/python-video4linux2-read-only/
let me know how you make out.
-david


--
Powered by Gentoo GNU/Linux
http://linuxcrazy.com
--
http://mail.python.org/mailman/listinfo/python-list


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. Which is what that last part is  
> making sure doesn't happen. I'm not a mathematician or anything so
> correct me if I'm wrong, but that's what I've read.

Where did you read that? Have you tried to verify it, like this:

| >>> [6*i+j for i in range(1, 21) for j in (1, 5) if (i+j) % 5]
| [7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 49, 53, 59, 61, 67,
71, 73, 77, 79, 83, 89, 91, 97, 101, 103, 107, 109, 113, 119, 121]

49, 77, 91, and 121 are not prime.

-- 
http://mail.python.org/mailman/listinfo/python-list


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 == 0. Which is what that last part is making sure doesn't happen. I'm
> not a mathematician or anything so correct me if I'm wrong, but that's what
> I've read.
 All you're doing is eliminating numbers divisible by 2,3, and 5.
Your generator includes   49  (7 * 7),  77 (7*11), 91 (7*13), 121 (11*11),  etc.
-- 
http://mail.python.org/mailman/listinfo/python-list


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-
>  cam (Quickcam Chat) only seems to work with GStreamer so a solution
>  using pygst would be preferred.
>  Thanks for your help,
>  Sam
> >>> Sorry, to clarify I am just having a hard time capturing frames in a
> >>> way that I can access with PIL.
> >> Most web cams produce jpeg images so read the note at the bottom 
> >> here;http://effbot.org/imagingbook/format-jpeg.htm
> >> What exactly are you trying to do? What have you tried so far and what
> >> happened may help.
>
> >> --
> >> Powered by Gentoo GNU/Linuxhttp://linuxcrazy.com
>
> > Dear David,
>
> > Thank you for your quick response. I have tried a few things. First of
> > all, I have tried gst-launch-0.10 v4l2src ! ffmpegcolorspace !
> > pngenc ! filesink location=foo.png. Foo.png comes out sharp enough but
> > it takes around 2 seconds to complete. I have also tried CVTypes but
> > it does not run without LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so and,
> > when it does run, it only displays colored "snow". Here is that code:
>
> > import pygame
> > import Image
> > from pygame.locals import *
> > import sys
>
> > import opencv
> > #this is important for capturing/displaying images
> > from opencv import highgui
>
> > camera = highgui.cvCreateCameraCapture(-1)
> > print "cam:" + str(camera)
> > def get_image():
> >    print "here"
> >    im = highgui.cvQueryFrame(camera)
> >    #convert Ipl image to PIL image
> >    return opencv.adaptors.Ipl2PIL(im)
>
> > fps = 30.0
> > pygame.init()
> > window = pygame.display.set_mode((320,240))
> > pygame.display.set_caption("WebCam Demo")
> > screen = pygame.display.get_surface()
>
> > while True:
> >    events = pygame.event.get()
> >    im = get_image()
> >    print im.mode
> >    pg_img = pygame.image.frombuffer(im.tostring(), im.size, im.mode)
> >    screen.blit(pg_img, (0,0))
> >    pygame.display.flip()
> >    pygame.time.delay(int(1000 * 1.0/fps))
>
> > Finally, I have gotten pygst to stream video with the example at
> >http://pygstdocs.berlios.de/pygst-tutorial/webcam-viewer.htmlbut of
> > course I do not know how to get a hold of that data. Just so you know,
> > I am trying a primitive type of object tracking. I would use some of
> > the libraries already available but the two more popular
> > implementations on Linux (tbeta/ccv and reacTIVision) dont seem to
> > work with my web cam. I have more info on those non-python attempts at
> >http://ubuntuforums.org/showthread.php?p=7596908. Unfortunately no one
> > seemed to respond to that post.
>
> > Thanks again,
> > Sam
>
> See if this gets you started, I got it working here with a video4linux2 
> cam.http://code.google.com/p/python-video4linux2/
> here is what I have, I think it is the 
> same;http://dwabbott.com/python-video4linux2-read-only/
> let me know how you make out.
> -david
>
> --
> Powered by Gentoo GNU/Linuxhttp://linuxcrazy.com

I gave it a shot and here is what I got:

s...@sam-laptop:~/python-video4linux2-read-only$ ./pyv4l2.py
Available devices:  ['/dev/video0']
/dev/video0
Capabilities:
Capture
ReadWrite
Streaming
Input 0:
Name:   zc3xx
Type:   camera
Standards: []
Pixel formats:
JPEGJPEG
Resolutions:
Segmentation fault

-

s...@sam-laptop:~/python-video4linux2-read-only$ ./streampics.py /dev/
video0 0 BGR3 640 480 testpics
Trying to create directory pics
Recording /dev/video0:0 with format JPEG at (640, 480)
Traceback (most recent call last):
  File "./streampics.py", line 94, in 
Run()
  File "./streampics.py", line 78, in Run
d.SetupStreaming(5, StreamCallback)
  File "/home/sam/python-video4linux2-read-only/pyv4l2.py", line 682,
in SetupStreaming
self.StreamOn()
  File "/home/sam/python-video4linux2-read-only/pyv4l2.py", line 636,
in StreamOn
lib.Error()
Exception: Could not start streaming:   22: Invalid argument
*** glibc detected *** python: free(): invalid next size (fast):
0x0a2aeff0 ***

Any suggestions?

Thanks,
Sam
-- 
http://mail.python.org/mailman/listinfo/python-list


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 interesting though, I can probably extend it to check  
for primality by using a more normal sieve method. It might be pretty  
fast too because generally it does only generate primes, and the few  
non primes it does generate could be caught quickly using a scratching  
out technique.


When I was initially looking at it there are some interesting patterns  
I might be able to extend into a generator that would yield only  
correct sets of numbers for the 6x + n pattern.



On Jul 12, 2009, at 10:26 PM, John Machin wrote:


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. Which is what that last part is
making sure doesn't happen. I'm not a mathematician or anything so
correct me if I'm wrong, but that's what I've read.


Where did you read that? Have you tried to verify it, like this:

| >>> [6*i+j for i in range(1, 21) for j in (1, 5) if (i+j) % 5]
| [7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 49, 53, 59, 61, 67,
71, 73, 77, 79, 83, 89, 91, 97, 101, 103, 107, 109, 113, 119, 121]

49, 77, 91, and 121 are not prime.

--
http://mail.python.org/mailman/listinfo/python-list


--
http://mail.python.org/mailman/listinfo/python-list


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 methods, but I only hand verified it.

"to verify" something means to ensure the truth or correctness, NOT
attempt to ensure ;-)
-- 
http://mail.python.org/mailman/listinfo/python-list


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 (synchronization)?
-- 
http://mail.python.org/mailman/listinfo/python-list


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
configuration runs successfully

step 2 make
it gives me error

case $MAKEFLAGS in  *-s*)  CC='gcc -pthread' LDSHARED='./Modules/
ld_so_aix gcc -pthread -bI:Modules/python.exp' OPT='-DNDEBUG -g -
fwrapv -O3 -Wall -Wstrict-prototypes' ./python -E ./setup.py -q
build;;  *)  CC='gcc -pthread' LDSHARED='./Modules/ld_so_aix gcc -
pthread -bI:Modules/python.exp' OPT='-DNDEBUG -g -fwrapv -O3 -Wall -
Wstrict-prototypes' ./python -E ./setup.py build;;  esac
running build
running build_ext
building 'bz2' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -
Wstrict-prototypes -I. -I/avre/Python-2.5.4/./Include -I. -IInclude -
I./Include -I/avre/Python-2.5.4/Include -I/avre/Python-2.5.4 -c /avre/
Python-2.5.4/Modules/bz2module.c -o build/temp.aix-6.1-2.5/avre/
Python-2.5.4/Modules/bz2module.o
building '_tkinter' extension
./Modules/ld_so_aix gcc -pthread -bI:Modules/python.exp build/
temp.aix-6.1-2.5/avre/Python-2.5.4/Modules/_tkinter.o build/
temp.aix-6.1-2.5/avre/Python-2.5.4/Modules/tkappinit.o -L/usr/X11/lib -
ltk8.4 -ltcl8.4 -lX11 -o build/lib.aix-6.1-2.5/_tkinter.so
*** WARNING: renaming "_tkinter" since importing it failed: 0509-022
Cannot load module build/lib.aix-6.1-2.5.
0509-026 System error: A file or directory in the path name does not
exist.

plz suggest
-- 
http://mail.python.org/mailman/listinfo/python-list