Finding duplicate file names and modifying them based on elements of the path

2012-07-18 Thread larry.mart...@gmail.com
I have an interesting problem I'm trying to solve. I have a solution almost working, but it's super ugly, and know there has to be a better, cleaner way to do it. I have a list of path names that have this form: /dir0/dir1/dir2/dir3/dir4/dir5/dir6/file I need to find all the file names (basename

Re: Finding duplicate file names and modifying them based on elements of the path

2012-07-19 Thread larry.mart...@gmail.com
On Jul 18, 6:36 pm, Simon Cropper wrote: > On 19/07/12 08:20, larry.mart...@gmail.com wrote: > > > > > > > > > > > I have an interesting problem I'm trying to solve. I have a solution > > almost working, but it's super ugly, and know there h

Re: Finding duplicate file names and modifying them based on elements of the path

2012-07-19 Thread larry.mart...@gmail.com
On Jul 18, 4:49 pm, Paul Rubin wrote: > "larry.mart...@gmail.com" writes: > > I have an interesting problem I'm trying to solve. I have a solution > > almost working, but it's super ugly, and know there has to be a > > better, cleaner way to do it. ...

Re: Finding duplicate file names and modifying them based on elements of the path

2012-07-19 Thread larry.mart...@gmail.com
On Jul 19, 1:02 pm, "Prasad, Ramit" wrote: > > > I am making the assumption that you intend to collapse the directory > > > tree and store each file in the same directory, otherwise I can't think > > > of why you need to do this. > > > Hi Simon, thanks for the reply. It's not quite this - what I a

Re: Finding duplicate file names and modifying them based on elements of the path

2012-07-19 Thread larry.mart...@gmail.com
On Jul 18, 4:49 pm, Paul Rubin wrote: > "larry.mart...@gmail.com" writes: > > I have an interesting problem I'm trying to solve. I have a solution > > almost working, but it's super ugly, and know there has to be a > > better, cleaner way to do it. ...

Re: Finding duplicate file names and modifying them based on elements of the path

2012-07-19 Thread larry.mart...@gmail.com
On Jul 19, 1:56 pm, Paul Rubin wrote: > "larry.mart...@gmail.com" writes: > > You can't do a len on the iterator that is returned from groupby, and > > I've tried to do something with imap or      defaultdict, but I'm not > > getting anywhere. I g

Re: Finding duplicate file names and modifying them based on elements of the path

2012-07-19 Thread larry.mart...@gmail.com
On Jul 19, 3:32 pm, MRAB wrote: > On 19/07/2012 20:06, larry.mart...@gmail.com wrote: > > > > > > > > > On Jul 19, 1:02 pm, "Prasad, Ramit" wrote: > >> > > I am making the assumption that you intend to collapse the directory > >>

Re: Finding duplicate file names and modifying them based on elements of the path

2012-07-19 Thread larry.mart...@gmail.com
On Jul 19, 1:43 pm, Paul Rubin wrote: > "larry.mart...@gmail.com" writes: > > Thanks for the reply Paul. I had not heard of itertools. It sounds > > like just what I need for this. But I am having 1 issue - how do you > > know how many items are in each group?

Re: Finding duplicate file names and modifying them based on elements of the path

2012-07-19 Thread larry.mart...@gmail.com
On Jul 19, 7:01 pm, "larry.mart...@gmail.com" wrote: > On Jul 19, 3:32 pm, MRAB wrote: > > > > > > > > > > > On 19/07/2012 20:06, larry.mart...@gmail.com wrote: > > > > On Jul 19, 1:02 pm, "Prasad, Ramit" wrote: > > &

Re: help with making my code more efficient

2012-12-20 Thread larry.mart...@gmail.com
On Thursday, December 20, 2012 5:38:03 PM UTC-7, Chris Angelico wrote: > On Fri, Dec 21, 2012 at 11:19 AM, larry.mart...@gmail.com > > wrote: > > > This code works, but it takes way too long to run - e.g. when cdata has > > 600,000 elements (which is typical for my a

Re: help with making my code more efficient

2012-12-20 Thread larry.mart...@gmail.com
On Thursday, December 20, 2012 6:17:04 PM UTC-7, Dave Angel wrote: > On 12/20/2012 07:19 PM, larry.mart...@gmail.com wrote: > > > I have a list of tuples that contains a tool_id, a time, and a message. I > > want to select from this list all the elements where the message

Re: help with making my code more efficient

2012-12-21 Thread larry.mart...@gmail.com
On Thursday, December 20, 2012 8:31:18 PM UTC-7, Dave Angel wrote: > On 12/20/2012 08:46 PM, larry.mart...@gmail.com wrote: > > > On Thursday, December 20, 2012 6:17:04 PM UTC-7, Dave Angel wrote: > > >> > > > Of course it's a fragment - it's part of

Re: help with making my code more efficient

2012-12-21 Thread larry.mart...@gmail.com
On Friday, December 21, 2012 10:57:19 AM UTC-7, larry@gmail.com wrote: > On Thursday, December 20, 2012 8:31:18 PM UTC-7, Dave Angel wrote: > > On 12/20/2012 08:46 PM, larry.mart...@gmail.com wrote: > > > On Thursday, December 20, 2012 6:17:04 PM UTC-7, Dave Angel wrote:

Re: help with making my code more efficient

2012-12-21 Thread larry.mart...@gmail.com
On Friday, December 21, 2012 8:19:37 PM UTC-7, Dave Angel wrote: > On 12/21/2012 03:36 PM, larry.mart...@gmail.com wrote: > > > On Friday, December 21, 2012 10:57:19 AM UTC-7, larry@gmail.com wrote: > > >> > > >> Didn't know about bisect. Th

Re: help with making my code more efficient

2012-12-24 Thread larry.mart...@gmail.com
On Friday, December 21, 2012 11:47:10 PM UTC-7, Dave Angel wrote: > On 12/21/2012 11:47 PM, larry.mart...@gmail.com wrote: > > On Friday, December 21, 2012 8:19:37 PM UTC-7, Dave Angel wrote: > >> On 12/21/2012 03:36 PM, larry.mart...@gmail.com wrote: > >&g

Re: Best way to structure data for efficient searching

2012-04-02 Thread larry.mart...@gmail.com
On Mar 28, 1:52 pm, Jon Clements wrote: > On Wednesday, 28 March 2012 19:39:54 UTC+1, larry@gmail.com  wrote: > > I have the following use case: > > > I have a set of data that is contains 3 fields, K1, K2 and a > > timestamp. There are duplicates in the data set, and they all have to > > proc

Best way to structure data for efficient searching

2012-04-02 Thread larry.mart...@gmail.com
I have the following use case: I have a set of data that is contains 3 fields, K1, K2 and a timestamp. There are duplicates in the data set, and they all have to processed. Then I have another set of data with 4 fields: K3, K4, K5, and a timestamp. There are also duplicates in that data set, and

parsing nested unbounded XML fields with ElementTree

2013-11-25 Thread larry.mart...@gmail.com
I have an XML file that has an element called "Node". These can be nested to any depth and the depth of the nesting is not known to me. I need to parse the file and preserve the nesting. For exmaple, if the XML file had: When I'm parsing Node "E" I need to know I

python script hangs when run from subprocess

2013-09-07 Thread larry.mart...@gmail.com
I have a python script and when I run it directly from the command line it runs to completion. But I need to run it from another script. I do that like this: p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) rv = p.wait() out_buf = p.stdout.read() When I do this, wait n

Re: python script hangs when run from subprocess

2013-09-07 Thread larry.mart...@gmail.com
On Saturday, September 7, 2013 5:19:25 AM UTC-6, Peter Otten wrote: > larry.mart...@gmail.com wrote: > > > > > I have a python script and when I run it directly from the command line it > > > runs to completion. But I need to run it from another script.

Re: python script hangs when run from subprocess

2013-09-07 Thread larry.mart...@gmail.com
On Saturday, September 7, 2013 9:47:47 AM UTC-6, Nobody wrote: > On Sat, 07 Sep 2013 03:55:02 -0700, larry.mart...@gmail.com wrote: > > > > > I have a python script and when I run it directly from the command line > > > it runs to completion. But I need to run i

setup.py not found

2009-07-17 Thread larry.mart...@gmail.com
I'm trying to install a package (cx_Oracle) on a mac running 10.5.7. I've done this on other platforms, but never on a mac. I followed the instructions given, but when I try and run setup I get: Apollo:instantclient_10_2 user$ python setup.py build /System/Library/Frameworks/Python.framework/Versi