In article <8f5014f6-9aa8-44e2-afe1-a1175bcdd...@w31g2000yqb.googlegroups.com>, moerchendiser2k3 <googler.1.webmas...@spamgourmet.com> wrote: > >I have a serious problem I haven't solved yet, hope one of you can >help me. The first thing is, I embedded Python into my app and I >execute several scripts in this environment. > >The problem is, the scripts don't import modules from their relative >path. I guess this is related to the sys.path ['',...] and the current >working directory which is set to the directory of my host >application. > >I could set that path manually, but all the scripts might be stored in >different locations. So now I try to find a way to handle that. Any >suggestions?
Set sys.path to include each script's base dir before running it, then restore after each script. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "If you don't know what your program is supposed to do, you'd better not start writing it." --Dijkstra -- http://mail.python.org/mailman/listinfo/python-list