Maybe a dumb question
Fabien HENON
fabien.henon at caramail.com
Tue Sep 10 17:58:38 EDT 2002
I have written an editor for Povray using Python, Tkinter and Pmw
It is available at :
http://pyvon.sourceforge.net
The software includes one main file and 6 others which are for the
language customization. People can choose between French, English,
German,...
All the translations for these languages are stored in files called
menu_francais.py, menu_english.py, menu_deutsch.py ....when the editor
is started.
I would like to clean the directory a bit and put all these 'languages
files' into a sub-directory called Lang.
How do I tell python to look into a particular sub-directory when
importing a file.
I tried the os.path.join syntax, but to no avail.
Below is the bit of code that imports the language file from the current
working directory :
try :
homedir = os.path.expanduser('~')
fd = open(homedir+"/.pyvonrc", 'r')
for line in fd.readlines():
if line.startswith("Language :"):
line=line[11:]
if line.startswith("francais"):from menu_francais import *
elif line.startswith("english"):from menu_english import *
elif line.startswith("deutsch"):from menu_deutsch import *
...............
Thanks,
Fabien
More information about the Python-list
mailing list