简体   繁体   English

Python无法访问Windows 7用户文件夹

[英]Python Can't Access Windows 7 User Folder

I have a wxPython app that writes user data to the Users folder at close. 我有一个wxPython应用程序,该应用程序在关闭时将用户数据写入Users文件夹。 In most cases it works fine. 在大多数情况下,它工作正常。 However, I get some error reports from users that the app cannot write to the Users/username folder. 但是,我从用户那里收到一些错误报告,该应用程序无法将其写入Users / username文件夹。

IOError: [Errno 13] Permission denied: u\\'C:\\\\Users\\\\usersname\\\\AppData\\\\Roaming\\\\app\\\\data.dat\\' IOError:[Errno 13]权限被拒绝:u \\'C:\\\\ Users \\\\ usersname \\\\ AppData \\\\ Roaming \\\\ app \\\\ data.dat \\'

What situation can cause a user not to be able to write to their own user folder? 什么情况会导致用户无法写入自己的用户文件夹? Does the user not always have read/write permissions to their own Users/username folder? 用户是否不总是对自己的“用户/用户名”文件夹具有读/写权限? How can I compensate for this issue? 我该如何弥补这个问题?

Thanks. 谢谢。

A possible reason is that the file is locked. 可能的原因是文件被锁定。 In this case you have no permission to write to the file until it is released. 在这种情况下,在释放文件之前,您无权写入该文件。 Are you sure you don't lock the file somehow yourself?! 您确定自己不会以某种方式锁定文件吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM