0

I am writing a Python script to edit a large C project. In this script I am using the subprocess module to call cscope's line oriented interface. This is an example of what I have been doing...

func_name = 'main'
p = subprocess.Popen(['cscope', '-d', '-L', '-0', func_name], stdout=subprocess.PIPE)
(output, err) = p.communicate() 

This works great for finding all the references to a function. The problem I am having is that output is just a long string of all the references. Is there a way to call this so it returns a list instead of one string? The string it returns is very hard to parse since there is no real pattern to it.

  • Can you add an example of the output, please? – Ry- Jul 10 '13 at 01:27
  • I figured it out...instead of using p.communicate() I used... for line in p.stdout: ref_list.append(line) This gave me a list of each line like I needed – toine216 Jul 10 '13 at 16:59

0 Answers0