だから私はこのようなディレクトリ構造を持っています
Execute_directory--> execute.py
|
Algorithm ---> algorithm.py
|
|--> data.txt
したがって、私は実行ディレクトリ内にいて、python パスへの次のパスを含めました。
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../Algorithm")
algorithm.py には data.txt を読み取るコードがあります
したがって、 execute.py を実行すると、 execute.py が algorithm.py を呼び出し、 data.txt が読み取られます。algorithm.py を見つけることはできますが、data.txt を見つけることはできませんか??
IOError: [Errno 2] No such file or directory:'data.txt'
私が間違っていることの手がかりはありますか?? ありがとう