Python Open File en relación con el módulo
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 os
dirname = os.path.dirname(__file__)
filename = os.path.join(dirname, 'relative/path/to/file/you/want')
import sys,os
sys.path.append(os.path.realpath('..'))