T
Thomas Dybdahl Ahle
Hi, I'm writing a gdesklets control, that dynamicly uses __import__ and
getattr to get the right classes based on userinput. The problem is, that
my control is somehow being run from somewhere unknown. This means that
__import__ can't find the modules. I tried putting an
os.chdir("~/.gdesklets/Controls/1136298021.06/...") just before the
__import__ call, and that worked, but ofcource isn't very smart in the run.
Is there any way to find out where the control is put on the disk, so that
I can change to the correct folder? Or is there some hack, that allows me
to import the modules without knowing there location?
getattr to get the right classes based on userinput. The problem is, that
my control is somehow being run from somewhere unknown. This means that
__import__ can't find the modules. I tried putting an
os.chdir("~/.gdesklets/Controls/1136298021.06/...") just before the
__import__ call, and that worked, but ofcource isn't very smart in the run.
Is there any way to find out where the control is put on the disk, so that
I can change to the correct folder? Or is there some hack, that allows me
to import the modules without knowing there location?