This is link to my older post in this connection cannot concatenate 'str' and 'file' objects : Python error
My code is now as below:
for src_filename, src_code in src_dict.iteritems():
try:
if src_filename == "weigh_of_the_fruit.c":
src_filepath = os.path.join(maindir, "folder/")
filename = src_filename
if not '/' in filename:
filename = os.path.join(src_filepath, filename)
a = open(filename, "r")
src_dict[src_filename] = subprocess.check_output("unifdef" +'-D'+definedFlags + '-U' +undefinedFlags+ filename, shell = True)
except:
subprocess.CalledProcessError, e:
# code
so I get an error on
src_dict[src_filename] = subprocess.check_output("unifdef" +'-D'+definedFlags + '-U' +undefinedFlags+ filename, shell = True)
I think this line doesn't detect the path - filename maindir is a path of repo and argument taken from command line.
P.S: I solved this problem. It was syntax error. I had to code space