基本的なファイル サーバーを構築していますが、プログラムがファイルを見つけることができません。
def sendfile(sock, myfile):
print 'Serving file:', myfile
print 'File exists?:', os.path.exists(myfile)
path = os.path.normpath(os.path.join(os.getcwd(), myfile))
print 'Serving file:', path
print 'File exists?:', os.path.exists(path)
'myfile' と 'path' が正しい [ファイルがサーバー プログラムと同じディレクトリにある] 場合でも、これらは常に False を返します。
IDLE は正常に動作しますが、関数に渡されません。
>>> print os.path.exists("/user/server/foo.txt")
True
私は何を逃したのですか?
[編集:] 出力:
Serving file: foo.txt
File exists?: False
Serving file: /user/server/foo.txt
File exists?: False