私.vimrc
の には、次の行があります。
map <F4> :w<cr>:!python %<cr>
ファイルが書き込まれた後に を使用して Python ファイルを編集し、vim /home/debian/rd.py
を押すと、次のエラーが発生します。F4
/bin/bash: /home/debian/rd.py: Permission denied
shell returned 126
Press ENTER or type command to continue
1 gphoto2 --get-all-files
1 0x670x700x680x6f0x740x6f0x320xc20xa00x200x2d0x2d0x670x650x740x2d0x610x6c0x6c0x2d0x660x690x6c0x650x730xa
2 gphoto2 --get-all-files
2 0x670x700x680x6f0x740x6f0x320x200x200x2d0x2d0x670x650x740x2d0x610x6c0x6c0x2d0x660x690x6c0x650x730xa
Press ENTER or type command to continue
結果は正しいのですが、なぜ結果がPermission denied
得られるのでしょうか?
編集:
デジタルカメラの写真をPCに取り込むためによく使用gphoto2 --get-all-files
しますが、コマンド
gphoto2 --get-all-files
が実行できないことがあります。現象に戸惑い、消去して再度入力すると動作します。同じように見える 2 つのコマンドをファイルに貼り付けました。ここからダウンロードし
て\tmp\compare.txt
、
ファイルの内容
gphoto2 --get-all-files
gphoto2 --get-all-files
理由を確認するためにvimを開いてPythonで小さなコードを書くと、
rd.py の内容
myfile=open("/tmp/compare.txt","rb")
for x,line in enumerate(myfile.readlines()):
print x+1,line,
str1=""
for char in line:
str1=str1+hex(ord(char))
print x+1,str1
F4 終了したら押す と、出力が表示されます。理由は 
コマンドにあります。
1 0x670x700x680x6f0x740x6f0x320xc20xa00x200x2d0x2d0x670x650x740x2d0x610x6c0x6c0x2d0x660x690x6c0x650x730xa
2 0x670x700x680x6f0x740x6f0x320x200x200x2d0x2d0x670x650x740x2d0x610x6c0x6c0x2d0x660x690x6c0x650x730xa
str1 は0xa0
str2 
より大きい