2016-05-26 7 views
0

私はまだPythonには新しく、私はPythonで設計したMicrosoft Word Docを作成するスクリプトツールの出力を翻訳しようとしています。
私が受信し続ける:python-docxを利用するPython-docx-IOError:[Errno 13]権限が拒否されました:

例外IOError:[errnoを13]アクセス許可が拒否されました: '5_26_2016.docx'

を誰もが、私がやっていることや、私はおそらくこの問題を解決できるかを説明することができます。コードは以下の通りです。 enter image description here

new_Survey_Date = Survey_Date.replace("/","_") # split method returns a list 
outTitleDoc = str(new_Survey_Date) 
docNum = 1 
print "OUTPUT DOC:" , outTitleDoc 
for theFile in ARCPY.ListFiles ("*.docx"): 
    if os.path.exists(outTitleDoc): 
     newOutTitleDoc = outTitleDoc 
     while os.path.exists(newOutTitleDoc): 
      newOutTitleDoc = outTitleDoc + "new" + str(docNum) 
      docNum = docNum + 1 
     outTitleDoc = newOutTitleDoc 
outTitleDoc = outTitleDoc + '.docx' 
document.save(outTitleDoc)  
+0

あなたのスクリプトが単に 'open( '5_26_2016.docx'、 'w')'の場合、同じエラーが発生しますか? –

+0

はい。具体的には – Beau

+0

__init__のファイル "C:¥Python27¥ArcGIS10.4¥Lib¥zipfile.py" 756行__init__内 self.fp = open(file、modeDict [mode]) IOError:[Errno 13]アクセス権が拒否されました: '5_27_2016.docx' (ExecutiveReport)の実行に失敗しました。 – Beau

答えて

0

必ず親フォルダにパス名をダブルチェック。それは開かないだろうということでした。それを開くために必要なフォルダが見つかりませんでした。

関連する問題