You need to use absolute filepaths to open them, but files
only lists filenames without a path. However, the root
variable does contain the path to the current directory.
Use os.path.join
to join the two:
for root, dir, files in os.walk(str(sys.argv[1])):
for fp in files:
f = open(os.path.join(root, fp), 'rb')