On Wed, Dec 24, 2008 at 5:55 PM, debug <[email protected]> wrote:
>
> Hi-
> I'm currently trying to work out the current location of the current
> running python plugin to get the path of a normal python I always use:
>
> currentDir = sys.argv[0]
> print (currentDir)
>
> However when I use it from a running python plugin I get the result:
>
Hello,
In case it's still useful at all, I was able to use maya.cmds.about to do this.
Like so:
def getMayaPath(self):
appEnvFile = cmds.about(env=True)
path, file = os.path.split(appEnvFile)
return path
I also had some other code that worked this into the Maya environment
variables, MAYA_SCRIPT_PATH, PYTHONPATH, etc...
Something like...
def setupSystemPaths(self):
self.conf.env_path = maya.mel.eval('getenv "PATH";')
self.conf.env_user_maya_path_and_version = self.getMayaPath()
tmp = self.getMayaPath() + "/scripts"
self.conf.env_user_maya_path_and_version_and_scripts = tmp
self.conf.env_path = self.conf.env_user_maya_path_and_version +
"/"
+ self.conf.roadkill_path + ";" + self.conf.env_path
maya.mel.eval( 'putenv "PATH" ' + '"' + self.conf.env_path +
'"' + ';')
def setupScriptPaths(self):
path = maya.mel.eval('getenv "MAYA_SCRIPT_PATH";')
new = path + ';' + self.getMayaPath() + '/scripts/MmmmTools'
maya.mel.eval( 'putenv "MAYA_SCRIPT_PATH" ' + '"' + new + '"' +
';')
self.conf.script_path = self.getMayaPath() + '/scripts'
Maybe that's useful?
I don't always read the stuff in this list, so if you want to contact
me, you can email me direct, using joetainment the domain at
gmail.com.
Sincerely,
Joe Crawford
___________________________________
Owner - Celestine Studios and Joetainment Enterprises
--~--~---------~--~----~------------~-------~--~----~
Yours,
Maya-Python Club Team.
-~----------~----~----~----~------~----~------~--~---