Could __path__ also be queried to obtain that info, in this case?

On Sep 24, 2009 5:02pm, Chris G <cgreb...@gmail.com> wrote:


> Non-builtin modules should have a __file__ attr:



> os.path.dirname(spam.__file__)





> -Chris



> On Thu, Sep 24, 2009 at 7:24 PM, AK Eric warp...@sbcglobal.net> wrote:

> >

> > In Python external to Maya, I'm used to doing this in a module, which

> > is a really convenient way to know the location the module is being

> > executed in. For a module living here:

> >

> > #----------

> > # c:/temp/spam.py

> > import os

> > import sys

> >

> > print "Module Save Location:", os.path.dirname(os.path.abspath(sys.argv

> > [0]))

> > #----------

> >

> > Would print if executed outside of Maya-Python:

> > c:/temp

> >

> > Makes it easy to find relative data.

> > But when I do this in Maya, no matter what, sys.argv[0] is always:

> >

> > C:\Program Files\Autodesk\Maya2010\bin\maya.exe

> >

> > Any module I put that code in returns back the Maya executable dir.

> > Driving me nuts! :) Anyone know a way around this?

> >

> > thanks

> >

> > >

> >



> 



--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---

Reply via email to