Re: Path when reading an external file

2016-03-28 Thread ast
"Martin A. Brown" a écrit dans le message de news:mailman.108.1459179618.28225.python-l...@python.org... Greetings, In a program "code.py" I read an external file "foo.txt" supposed to be located in the same directory that "code.py" python/src/code.py python/src/foo.txt In "code.py": f =

Re: Path when reading an external file

2016-03-28 Thread Martin A. Brown
Greetings, > In a program "code.py" I read an external file "foo.txt" supposed > to be located in the same directory that "code.py" > > python/src/code.py > python/src/foo.txt > > In "code.py": f = open('foo.txt', 'r') > > But if I run "python code.py" in an other dir than src/ say in > python/

Path when reading an external file

2016-03-28 Thread ast
Hello In a program "code.py" I read an external file "foo.txt" supposed to be located in the same directory that "code.py" python/src/code.py python/src/foo.txt In "code.py": f = open('foo.txt', 'r') But if I run "python code.py" in an other dir than src/ say in python/, it will not work bec