0
我有這樣的:蟒蛇os.open使用,同時打開一個目錄
drwxr-xr-x 8 abc root 4096 Dec 21 19:56 javaprac
這工作:
>>> fd = os.open(os.getcwd() , os.O_RDONLY)
但是,爲什麼這兩個失敗:
>>> fd = os.open(os.getcwd() , os.O_RDWR)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 21] Is a directory: '/home/abc/javaprac'
>>> fd = os.open(os.getcwd() , os.O_WRONLY)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 21] Is a directory: '/home/abc/javaprac'
你爲什麼要直接寫*到目錄節點?你想在這裏做什麼? –
@MartijnPieters我的問題很簡單直接,沒有更深的含義:爲什麼我不能寫入這樣的目錄?爲什麼行爲是這樣的? – abc