python.path.append() can't access 2 directories above - Windows10

751 views Asked by At

I'm trying to create a unit testing folder outside of the program itself. The structure of the program is as follows:

TheProgram
-- Folder_1
-- -- File_1.py

unittest
-- TestFolder1
-- -- TestFile_1.py

From TestFile_1.py the path accessing code was

import sys
sys.path.append("../../TheProgram/Folder_1")
from File_1.py import *

The system couldn't find the Folder_1 directory. The following code was also tested but yielded the same result: sys.path.insert(2, "TheProgram/Folder_1"). Both the TheProgram and the unittest folders are in the same directory.

How do you access File_1.py from TestFile_1.py in this case?

0

There are 0 answers