Python Öffnen Sie die Datei im Vergleich zum Modul
import os
TEST_FILENAME = os.path.join(os.path.dirname(__file__), 'test.txt')
Good Goshawk
import os
TEST_FILENAME = os.path.join(os.path.dirname(__file__), 'test.txt')
import sys
sys.path.append("") # fixes import issues
from your_file import your_class
# OR
from your_dir.your_file import your_class
# also, make sure there is an empty __init__.py file in each directory
import os, sys
sys.path.append('../package1/module1.py')