Powerful Command line parsers

2006-04-21 Thread PyPK
Is there a Command line parser in python that can: 1. resolve conflicts 2. specify something like requires 3. and smart for ex: python test.py --a --b --c --d Case 1: If 'a' is an option 'b' or 'c' cannot be specified. Case 2: atleast one option should be specified Case 3: IF 'a' and 'c' are gi

Powerful Command line parser

2006-04-21 Thread PyPK
Is there a Command line parser in python that can: 1. resolve conflicts 2. specify something like requires 3. and be smart for ex: python test.py --a --b --c --d Case 1: If 'a' is an option 'b' or 'c' cannot be specified. Case 2: atleast one option should be specified Case 3: IF 'a' and 'c' are

Re: member variables in python

2006-03-31 Thread PyPK
I see that.But here in my case the testflags is computed inside the member function something like class AA: def __init__(self): self.test_flag = 0 # initialize def methods(self, value): save_value = _munge(value) self.test_flag = save_value N

Re: member variables in python

2006-03-31 Thread PyPK
ok I reason I was going with globals is that i use this variable in another class something like this along with above testflag = 0 class AA: def __init__(...): def methos(self,...): global testflag testflag = xx class BB: def __init__(...): def method2(..): if

member variables in python

2006-03-31 Thread PyPK
hi how do I write this better with member variables rather than global as you see below. eg: test-flag = 0 class AA: def __init__(...): def methos(self,...): global test-flag test-flag = xx instead of something like above ..how do i put it i terms of member variables? -- h

understanding mod_python

2005-12-19 Thread PyPK
Hi I'm trying to learn mod python and need some one to explain how to do http redirection(302) with an example code -- http://mail.python.org/mailman/listinfo/python-list

Re: calculate system disk space

2005-12-09 Thread PyPK
I am looking for unix.the recipe is windows specific!! -- http://mail.python.org/mailman/listinfo/python-list

calculate system disk space

2005-12-09 Thread PyPK
how can we compute the current system disk space using a python script.? any ideas or have anyone tried this.. -- http://mail.python.org/mailman/listinfo/python-list

Add attribute using pyxml

2005-11-01 Thread PyPK
How do I add a new attribute to the existing xml Document tree??? -- http://mail.python.org/mailman/listinfo/python-list

Re: Tricky Areas in Python

2005-10-23 Thread PyPK
hmm Thats one thing. Also I was thinking of something like benefites of python over other languages. Probably that coould be one ? -- http://mail.python.org/mailman/listinfo/python-list

Tricky Areas in Python

2005-10-23 Thread PyPK
What possible tricky areas/questions could be asked in Python based Technical Interviews? -- http://mail.python.org/mailman/listinfo/python-list

Function to execute only once

2005-10-14 Thread PyPK
Hi if I have a function called tmp=0 def execute(): tmp = tmp+1 return tmp also I have def func1(): execute() and def func2(): execute() now I want execute() function to get executed only once. That is the first time it is accessed. so taht when funcc2 access the

Re: File compare

2005-10-14 Thread PyPK
but what if case 1: no.of keys in f1 > f2 and case2: no.of keys in f1 < f2. Should'nt we get 1.1 if case 1 and 0.9 if case 2?? it errors of with a keyerror.? -- http://mail.python.org/mailman/listinfo/python-list

Re: File compare

2005-10-12 Thread PyPK
Not for homework. But anyway thanks much... -- http://mail.python.org/mailman/listinfo/python-list

Re: File compare

2005-10-12 Thread PyPK
Note that the code i wrote wont do the compare based on id which i am looking for..it just does a direct file to file compare.. -- http://mail.python.org/mailman/listinfo/python-list

File compare

2005-10-12 Thread PyPK
I have two files file1 in format 'AA' 1 T T 'AB' 1 T F file2 same as file1 'AA' 1 T T 'AB' 1 T T Also the compare should be based on id. So it should look for line starting with id 'AA' (for example) and then match the line so if in second case. so this is what I am looking for: 1. read

Pixel Manipulations

2005-09-28 Thread PyPK
Does anyone know of a simple implementation for detecting straight line .So something like if we have a 2D arary of pixel elements representing a particular Image. How can we identify lines in this Image. for example: ary = [[1,1,1,1,1], [1,1,0,0,0], [1,0,1,0,0], [1,0,0,1,0], [1,0,0,0,1]] So i

Straight line detection

2005-09-28 Thread PyPK
Does anyone know of a simple implementation of a straight line detection algorithm something like hough or anything simpler.So something like if we have a 2D arary of pixel elements representing a particular Image. How can we identify lines in this Image. for example: ary = [[1,1,1,1,1], [1,1,0,0

Line Scan and Removal

2005-09-20 Thread PyPK
i I need some help on some problem I am trying to think of. are there any algorithms available to do the following If not, any ideas?: I would like to Identify any lines of any orientation and width in an Image and remove them from the Image. Basically I would like to scan the entire Image for li

Re: Grouping lists

2005-09-12 Thread PyPK
hmm thanks for that..but kind of not sure how this groupby works.. also if I want to group elements with one value apart how would this change.Should this change in groupby part or in the loop? something like... lst = [1,1,2,1,3,5,1,1,1,1,2,7,7] returns (0,3),4,5,(6,10),(11,12) so its something lik

Grouping lists

2005-09-09 Thread PyPK
If I have a list say lst = [1,1,1,1,3,5,1,1,1,1,7,7,7] I want to group the list so that it returns groups such as [(0,3),4,5,(6,9),(10,12)]. which defines the regions which are similar. Thanks, -- http://mail.python.org/mailman/listinfo/python-list

Line Removal strategy

2005-08-23 Thread PyPK
Hi I am looking for a simple algorithm for removing straight lines in a given Image using something like an PIL or simpler. -- http://mail.python.org/mailman/listinfo/python-list

Re: Tiff Image Reader/writer

2005-06-14 Thread PyPK
I get a decoder error when i do a get pixel on the Image >>> im.getpixel((12,34)) Traceback (most recent call last): File "", line 1, in ? File "Image.py", line 858, in getpixel self.load() File "/usr/local/lib/python2.4/site-packages/PIL/ImageFile.py", line 180, in load d = Image._

Re: Tiff Image Reader/writer

2005-06-13 Thread PyPK
When i try this i get this error: import Image >>> im = Image.open('image.tif') >>> im.getpixel((10,19)) Traceback (most recent call last): File "", line 1, in ? File "Image.py", line 858, in getpixel self.load() File "/usr/local/lib/python2.4/site-packages/PIL/ImageFile.py", line 180, i

Re: Tiff Image Reader/writer

2005-06-13 Thread PyPK
One reason why I don't want to use PIL is it seems very slow for tiff images of very large sizes(2400x4800). So I am looking for a better tool than does the right job faster. -- http://mail.python.org/mailman/listinfo/python-list

Re: Tiff Image Reader/writer

2005-06-13 Thread PyPK
nothing fancy. I just want to be able to read a tiff image, get pixel values, write back to a tiff file. -- http://mail.python.org/mailman/listinfo/python-list

Re: Tiff Image Reader/writer

2005-06-13 Thread PyPK
Is there any package out there which handles Tiff Images other than PIL or ImageMagic . -- http://mail.python.org/mailman/listinfo/python-list

Tiff Image Reader/writer

2005-06-13 Thread PyPK
Hi I am looking for a simple tiff Image reader/writer in python.Can anyone point me to the right one. -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance Issues please help

2005-06-02 Thread PyPK
Yep that improved the speed by about 50% now it takes about 10 secs instead of 24 seconds..Thanks much. I guess that is the best we could do right.It would be really helpful if I could get it less than 5 seconds. Any suggestions on that?? -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance Issues please help

2005-06-01 Thread PyPK
>Info req'd for discussing algorithm changes: >1. How much free memory do you have? - Memory is not a problem but I am working on some timing constraints.Thats is the reason I am a bit concerned abt these 30 seconds > 2. What can you tell us about the distribution of "e"? - the distribution

Performance Issues please help

2005-06-01 Thread PyPK
I was testing this piece of code and it takes about 24-30 seconds to do a look up on a list(m) of size 1000x1000 m -> list of size 1000x1000 import time print time.ctime() box = {} for r,row in enumerate(m): for c,e in enumerate(row): if box.has_key(e): params = box[e]