Maybe a dumb question

Fabien HENON fabien.henon at
Tue Sep 10 17:58:38 EDT 2002

I have written an editor for Povray using Python, Tkinter and Pmw

It is available at :

The software includes one main file and 6 others which are for the 
language customization. People can choose between French, English, 
All the translations for these languages are stored in files called,, ....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 :"):
	if   line.startswith("francais"):from menu_francais import *
         elif line.startswith("english"):from menu_english import *
         elif line.startswith("deutsch"):from menu_deutsch import *



More information about the Python-list mailing list