permission change of files in python
You can instead use an OS specific function call as follows:
os.system('chmod 777 -R *')
You are using os.walk
incorrectly.
for dirpath, dirnames, filenames in os.walk('.'):
for filename in filenames:
path = os.path.join(dirpath, filename)
os.chmod(path, 0o777) # for example