I have
Following piece of code:
for src_filename, src_code in src_dict.iteritems():
try:
set.dependencies = subprocess.check_output('unifdef -s /home/c/maindir/folder/' +src_filename, shell=True)
except subprocess.CalledProcessError, e:print "code is bad" +set.propertyset.bad = 1raise
set.dependencies = list(set(set.dependencies.splitlines()))
I wanted to un-hardcode the path so I wrote following piece of code:
filepath = os.path.join(maindirpath, "folder/")
maindir is argument here: /home/c/maindir
path = open(filepath)set.dependencies = subprocess.check_output("unifdef" '-s' path +src_filename, shell=True)
It throws following error:
TypeError: cannot concatenate 'str' and 'file' objects
I am new to python. can anybody help, where I am getting wrong?