基本的に、Python 2.6 で記述された FileExplorer クラスがあります。それはうまく機能し、ドライブ、フォルダーなどをナビゲートできます。ただし、特定のフォルダー'C:\Documents and Settings/ .*'* に到達すると、スクリプトの基になっている os.listdir がこのエラーをスローします:
WindowsError: [エラー 5] アクセスが拒否されました: 'C:\Documents and Settings/ . '
何故ですか?このフォルダが読み取り専用だからでしょうか? それとも、Windows が保護していて、私のスクリプトがアクセスできないものですか?!
問題のあるコードは次のとおりです(3行目):
def listChildDirs(self):
list = []
for item in os.listdir(self.path):
if item!=None and\
os.path.isdir(os.path.join(self.path, item)):
print item
list.append(item)
#endif
#endfor
return list