[Tutor] File path requirements (absolute or relative)?

boB Stepp robertvstepp at gmail.com
Fri May 15 16:31:03 EDT 2020


My file structure for a project is as follows:

~
     | Projects
         | project_name
             | docs
             | src
                 project_name.py
             | tests
                 test.py
                 test_csv_file.csv

I wish to pass the path for "test_csv_file.csv" from the test.py program to
the function in src/project_name.py which processes csv files.  Ideally I
would like to use a relative path name like "../tests/test_csv_file" and
have the function in src/project_name.py to be able to use it.  But so far
all of my efforts to use a relative path name have failed.  Even
"~/Projects/project_name/tests/test_csv_file.csv" fails.  Only when I use
the absolute path name
"/Home/bob/Projects/project_name/tests/test_csv_file.csv" does the test
complete successfully.  What am I misunderstanding?

-- 
Wishing you only the best,

boB Stepp


More information about the Tutor mailing list