我得到了:
Python - IOError: [Errno 13] Permission denied
我想从文件中读取。我的代码是:
with open(in_filename, 'rb') as infile:
with open(out_filename, 'wb') as outfile:
outfile.write(b)
while True:
buf = infile.read(1024)
if not buf:
break
outfile.write(cipher.update(buf))
outfile.write( cipher.final() )
outfile.close()
infile.close()
我在with open(in_filename, 'rb') as infile:
行收到错误。
infile= c:\\users\\cipher~1\\appdata\\local\\temp\\CCB\\16977740fbd0f8491aca818446b9d6c703a2b14d\\allpolicies.rtf
out_filename= D:\\one.rtf
我正在生成infile location tempfile.gettempdir()+ os.sep +" CCB" ,然后使用哈希函数生成下一个文件夹。然后将文件放在该位置。
我也试过os.sep
,但它没有用。相同的代码与.txt文件一起正常工作。