for src_file, src_code in src_dict.iteritems():
# assuming, here, that you want to honor the handle's path if already given
filename = src_file.name
if not "https://stackoverflow.com/" in filename:
filename = os.path.join(filepath, filename)
try:
set.dependencies = subprocess.check_output(['unifdef', '-s', filename])
except subprocess.CalledProcessError:
pass # etc.
By the way, set
is a bad variable name, since set
is also a Python data type; you’re making the data type unusable in your code by shadowing it with a like-named variable. Don’t do that!
3
solved cannot concatenate ‘str’ and ‘file’ objects : Python error