How To Get The Current Working Directory?

Hi,

I have developed a Plug-In for Maya. In my UI I have three pictures which are located in the scrips folder. So they are in the same folder as the sourcefiles of my Plug-In. But if the Plug-In is installed at another system I have to find out where the script folder is located. I know normaly it is in the home directory but this is not always sure.
Now I tried to use the "os.getcwd() " Method but I get the directory from which I opened the scene and not the directory where the sourcefiles are.
So I thought I can readout the PYTHONPATH varibale which is located in the maya.env file. But I don’t know how to do this. At first there is the same problem with the path to this file. Secondly I don’t know if there is any way to read out the variable with python over Maya.

I would be very thankful if anyone can give me a solution to this problem.

Thanks

simply you can use
CODE
sys.path[0]
to find from where the python script is got called

I tried

CODE
sys.path[0]

but if I run my script in Maya I get this back:

C:\Programme\Autodesk\Maya2008\bin

But thank you anyway I’ve realy forgotten this command .

Oh I’m so stupid. I think I’ve tried all versions to get the path but the only thing I’ve never used is simply

CODE
self.uiImage =‘.\uiImage.bmp’

using the relativ path. doh

Thank you for help.

I recommend using the variable __file__