unittest - sort cases to be run

2012-08-21 Thread Kevin Zhang
Hi all,

I want to sort the order of the unittest cases to be run, but found such
statement in Python doc,
"Note that the order in which the various test cases will be run is
determined by sorting the test function names with respect to the built-in
ordering for strings."

s.addTest(BTest())
s.addTest(ATest())
TextTestRunner().run(ts)

I need BTest() to be run prior to ATest(), is there any natural/beautiful
way to achieve this? Thanks,
-- 
http://mail.python.org/mailman/listinfo/python-list


python polygon

2012-04-05 Thread Kevin Zhang
Hi,

I found python polygon link in this page
http://pypi.python.org/pypi/Polygon/1.17 was invalid now.

http://polygon.origo.ethz.ch/download
404 - Project not found

Ooops, the subdomain is not valid because the according project does not
(yet) exist.
Go to the Origo main page at http://origo.ethz.ch

Can anyone provide some updates on this?

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


Re: Finding duplicated photo

2011-07-10 Thread Kevin Zhang
On Fri, Jul 8, 2011 at 8:37 PM, Billy Mays  wrote:
>
>
> I recently wrote a program after reading an article (
> http://www.hackerfactor.com/**blog/index.php?/archives/432-**
> Looks-Like-It.html)
>  using the DCT method he proposes.  It worked surprisingly well even with
> just the 64bit hash it produces.
>
>
The link you provided was so great.
It mentioned an implementation of the hash algorithm in Python though
invalid, so I spent some time writing my own version.
It works really fine and kind of solved the problem of finding duplicated
pictures to delete I recently came across.

Thanks Billy!

ps.
If anyone's interested, pleas checkout the source code in the attachment and
welcome any advise.


pic_seeker.py
Description: Binary data
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Finding duplicated photo

2011-07-11 Thread Kevin Zhang
On Mon, Jul 11, 2011 at 10:50 PM, Fulvio  wrote:
>
>
> I found that isn't python 3 code :(
>
> It's written in python 2.6.


> Then the code should go into some other program to allow actions on those
> pictures which are matching each other. Am I right?
>
> The leverages PIL to get the job done.

The performance from PIL's quite poor, though not precisely measured, most
of the time was
spent on resizing pictures with PIL.
-- 
http://mail.python.org/mailman/listinfo/python-list


Python import search path

2011-08-20 Thread Kevin Zhang
Hi,

This is the directory tree.
project
└── sme
├── src
│   ├── a.pth
│   ├── sss.py
└── test
└── ttt.py

I need to import sss.py in ttt.py.

Found a few solution in python docs.
A. sys.path.append
B. add ***.pth file
C. edit .../site-packages/site.py

I found out that a.pth only works when in directory like
/usr/lib/pythonX.Y/site-packages
instead of in current directory.

I think A is not so pretty, and I don't have root  privilege to use B and C.
So any both more elegant and practical solutions?
Thanks.

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