В моем файле настроек у меня есть следующие строки:
import os
import sys
PROJECT_ROOT = os.path.dirname(__file__)
sys.path.insert(0, os.path.join(PROJECT_ROOT, "apps"))
file_path = os.path.join(os.path.realpath(os.path.dirname(__file__)),"..", "webapp.cfg")
Под Windows, если os.path.realpath(os.path.dirname(__file__))
равно D:\Projects\Test\src\test
в file_path
, у меня будет D:\Projects\Test\src\webapp.cfg
. Это не работает в Ubuntu 8.04.
EDIT1: Я запускаю Ubuntu 8.04 на виртуальной машине. У меня установлена версия Python 2.5.2.