我有一個問題,如果我雙擊我的腳本(.py),或者用IDLE打開它,它會編譯並運行正確。但是,如果我嘗試在我的Windows命令行運行腳本,使用Python腳本運行雙擊和IDLE但不是Windows CMD shell
C:\> "C:\Software_Dev\Python 2.7.1\python.exe" C:\path\to\script\script.py
我得到...
Traceback (most recent call last):
File "C:\path\to\script\script.py", line 66, in <module>
a.CheckTorrent()
File "C:\path\to\script\script.py", line 33, in script
self.WriteLog(fileName)
File "C:\path\to\script\script.py", line 54, in WriteLog
myFile = open(r'%s' %(filename), 'w')
IOError: [Errno 13] Permission denied: './TorrentMonitor.log'
所以我的問題是,爲什麼我得到許可錯誤,當我運行這個腳本通過命令行在窗口7但不是當我雙擊?這兩個過程有什麼區別?
在此先感謝!
謝謝你們倆!我沒有意識到這種行爲,並花了我數小時才終於弄清楚了。但是,多虧了你們,這很有用。 – foboi1122 2011-04-02 20:13:16