I agree Ian,

Are you hand-setting PYTHONPATH in all of your user's system
environment
variables (via windows System Properties-> Advanced -> Environment
Variables, etc.)?

or are you setting PYTHONPATH via Maya.env?
(which is my current plan to do, which means my install scripts
need to hack everybody's Maya.env upon install of our tools).

I tried to 'putenv PYTHONPATH 'via userSetup.mel scripts but it did
not put it
'quick enough', it is too late once it gets to userSetup.mel scripts.

Thanks,

-jason

On Feb 5, 4:26 pm, Ian Jones <i...@ambientdivide.com> wrote:
> Looks like what is inside your sitecustomize.py file is correct
> (assuming the paths etc are all spelled correctly) which means that
> the sitecustomize.py file is likely not in your PYTHONPATH by the time
> maya starts. The folder containing sitecustomize must be in the
> PYTHONPATH when the python interpreter is first initialized.
>
> On Fri, Feb 5, 2010 at 4:14 PM, Chad Dombrova <chad...@gmail.com> wrote:
> > hi zero,
>
> >> It is only being executed in these default maya install paths:
>
> >> (*)C:\Program Files\Autodesk\Maya2008\bin
> >> (*)C:\Program Files\Autodesk\Maya2008\Python\DLLs
> >> (*)C:\Program Files\Autodesk\Maya2008\Python\lib
> >> (*)C:\Program Files\Autodesk\Maya2008\bin
> >> (*)C:\Program Files\Autodesk\Maya2008\Python
> >> (*)C:\Program Files\Autodesk\Maya2008\Python\lib\site-packages
>
> >> but not in these:
>
> >> C:/Documents and Settings/jparks/My Documents/maya/2008/prefs/scripts
> >> C:/Documents and Settings/jparks/My Documents/maya/2008/scripts/
> >> C:/Documents and Settings/jparks/My Documents/maya/scripts
>
> > i believe that's because the last three are added by maya after it has
> > already begun it's startup process.  check maya.app.startup.basic:
>
> > def setupScriptPaths():
> >    """
> >    Add Maya-specific directories to sys.path
> >    """
> >    # Extra libraries
> >    #
> >    try:
> >        # Tkinter libraries are included in the zip, add that subfolder
> >        p = [p for p in sys.path if p.endswith('.zip')][0]
> >        sys.path.append( os.path.join(p,'lib-tk') )
> >    except:
> >        pass
>
> >    # Per-version prefs scripts dir (eg .../maya8.5/prefs/scripts)
> >    #
> >    prefsDir = cmds.internalVar( userPrefDir=True )
> >    sys.path.append( os.path.join( prefsDir, 'scripts' ) )
>
> >    # Per-version scripts dir (eg .../maya8.5/scripts)
> >    #
> >    scriptDir = cmds.internalVar( userScriptDir=True )
> >    sys.path.append( os.path.dirname(scriptDir) )
>
> >    # User application dir (eg .../maya/scripts)
> >    #
> >    appDir = cmds.internalVar( userAppDir=True )
> >    sys.path.append( os.path.join( appDir, 'scripts' ) )
>
> > On Feb 5, 2010, at 4:05 PM, Count Zer0 wrote:
>
> >> Ian,
>
> >> Tried to reply earlier, but don't know if it went through. Google
> >> groups delays the post sometimes.
>
> >> My sitecustomize.py is just like the instructions:
>
> >> import sys
> >> sys.path.insert(0,'Y:/Tools/SOEmayaTools/python/pymel-1.0.0rc1')
>
> >> nor in any other path added via any kind of userSetup.mel.
>
> >> Where is your sitecustomize.py? Is it in one of those default install
> >> paths or a custom path? and if it is in a custom path, how was it
> >> added? via sys.path.append/insert or putenv PYTHONPATH?
>
> >> Thanks for print to output tip.
>
> >> Thanks,
>
> >> -jason
>
> >> Ian Jones wrote:
>
> >>> I've been doing this for sometime with great success. We currently
> >>> insert pymel (from a network location) to the front of the path with
> >>> sitecustomize. What is in your sitecustomize.py file? and are you sure
> >>> that it is being executed?
>
> >>> I have a print at the top of mine which you should see in the output
> >>> window when you start maya. A nice check is that if that print happens
> >>> in the script editor it is being executed too late in the process to
> >>> make a different.
>
> >>> Ian
>
> >>> On Fri, Feb 5, 2010 at 1:24 PM, Count Zer0 <count....@gmail.com> wrote:
>
> >>>> "
> >>>> Manual Method 4: sitecustomize
>
> >>>> ...
>
> >>>> 4. save this file as sitecustomize.py somewhere in your system python
> >>>> path.
> >>>> "
>
> >>>> Only the default maya install locations, (*) paths, seem to inject
> >>>> pymel path early enough, so you might as well use Method 3: pymel.pth.
>
> >>>> (*)C:\Program Files\Autodesk\Maya2008\bin
> >>>> ..
> >>>> (*)C:\Program Files\Autodesk\Maya2008\Python\DLLs
> >>>> (*)C:\Program Files\Autodesk\Maya2008\Python\lib
> >>>> ..
> >>>> (*)C:\Program Files\Autodesk\Maya2008\bin
> >>>> (*)C:\Program Files\Autodesk\Maya2008\Python
> >>>> (*)C:\Program Files\Autodesk\Maya2008\Python\lib\site-packages
> >>>> C:/Documents and Settings/jparks/My Documents/maya/2008/prefs/scripts
> >>>> C:/Documents and Settings/jparks/My Documents/maya/2008/scripts/
> >>>> C:/Documents and Settings/jparks/My Documents/maya/scripts
>
> >>>> Putthing this in userSetup.mel does not work either:
> >>>> python("import sys;sys.path.insert(0,'/path/to/top-pymel-dir');");
>
> >>>> Nor does this in userSetup.mel:
> >>>> putenv "PYTHONPATH" (`getenv "PYTHONPATH"` + ";/path/to/top-pymel-
> >>>> dir");
>
> >>>> Adding PYTHONPATH to Maya.env or the system's environment variable
> >>>> seems to work, but that is a pain to do w/ install scripts.
>
> >>>> Anybody know how to get pymel path inserted early enough w/
> >>>> sitecustomize in a non-Maya install folder?
>
> >>>> -jason
>
> >>>> On Jan 25, 11:50 am, Chad Dombrova <chad...@gmail.com> wrote:
>
> >>>>> i hope to have the official docs updated in a few days.  in the
> >>>>> meantime, ian was nice enough to post his instructions here:
> >>>>>  http://github.com/shrtcww/pymel/blob/1e4d2fbab671445b21e89c0c7a6f2b7d...
>
> >>>>> github automatically turns the restructuredText into html, which is
> >>>>> awesome.
>
> >>>>> -chad
>
> >>>>> On Jan 25, 2010, at 11:47 AM, Drew wrote:
>
> >>>>>> Awesome - i've never used sitecustomize before so seeing an example of
> >>>>>> how to set this up would be great.  Thx ian!
>
> >>>>>> On Jan 21, 6:35 pm, Ian Jones <i...@ambientdivide.com> wrote:
>
> >>>>>>> Sure can
>
> >>>>>>> On Thu, Jan 21, 2010 at 6:21 PM, Chad Dombrova <chad...@gmail.com>
> >>>>>>> wrote:
>
> >>>>>>>> ian, can you provide some instructions on how to set this up that
> >>>>>>>> we can
> >>>>>>>> include in the docs?
>
> >>>>>>>> On Thu, Jan 21, 2010 at 4:51 PM, Ian Jones
> >>>>>>>> <i...@ambientdivide.com> wrote:
>
> >>>>>>>>> Drew,
>
> >>>>>>>>> What I've been doing is using sitecustomize to inject pymel to the
> >>>>>>>>> front of the python path at startup. The `downside` is that pymel
> >>>>>>>>> shows up in the python path universally but some of the utils
> >>>>>>>>> that are
> >>>>>>>>> included I've been learning/finding great use for in other
> >>>>>>>>> places. The
> >>>>>>>>> Path class in particular - love that thing. So it's not really that
> >>>>>>>>> much of a `downside` after all.
>
> >>>>>>>>> Ian
>
> >>>>>>>>> On Thu, Jan 21, 2010 at 12:18 PM, Drew <drewskill...@gmail.com>
> >>>>>>>>> wrote:
>
> >>>>>>>>>> Hi Chad,
>
> >>>>>>>>>> Thanks to you and Jason for helping me out here.
>
> >>>>>>>>>> Do you know if .pth files can have env variables in them?  Our
> >>>>>>>>>> pymel
> >>>>>>>>>> install location will vary from project to project (all project
> >>>>>>>>>> data
> >>>>>>>>>> is lumped under a project specific directory), so if i do hack the
> >>>>>>>>>> maya install it would be great if it could play nice when you're
> >>>>>>>>>> switching between projects.
>
> >>>>>>>>>> Even if it does support env vars, i'm still not super comfortable
> >>>>>>>>>> hacking the maya install itself.  I prefer to keep all the maya
> >>>>>>>>>> customization we do easily tractable from the maya.env. For
> >>>>>>>>>> example a
> >>>>>>>>>> tools programmer troubleshooting problems a year from now and not
> >>>>>>>>>> realizing that custom scripts/plugins are being referenced from
> >>>>>>>>>> the
> >>>>>>>>>> install directory itself.  That said, it sounds like the .pth is
> >>>>>>>>>> probably our best option right now.  (and fyi - i am using maya
> >>>>>>>>>> 2008).
>
> >>>>>>>>>> For the record, my ideal option would be a PYMELPATH env var
> >>>>>>>>>> (definable either though windows or the maya.env) that makes all
> >>>>>>>>>> this
> >>>>>>>>>> magic sauce work.  Though I'm sure there are some good reasons why
> >>>>>>>>>> it's not setup that way.
>
> >>>>>>>>>> Thx again!
> >>>>>>>>>> Drew
>
> >>>>>>>>>> On Jan 20, 11:16 pm, Chad Dombrova <chad...@gmail.com> wrote:
>
> >>>>>>>>>>> hi zero,
> >>>>>>>>>>> we know this ordering can be a bit tricky to accomplish for
> >>>>>>>>>>> those who
> >>>>>>>>>>> are not using the "easy" install method, especially on a
> >>>>>>>>>>> windows machine
> >>>>>>>>>>> where PYTHONPATH might be set as a system environment variable
> >>>>>>>>>>> that the user
> >>>>>>>>>>> cannot override.   to help out in these situations, we've added
> >>>>>>>>>>> a third
> >>>>>>>>>>> install option to the 1.0 docs, for those who have write access
> >>>>>>>>>>> to their
> >>>>>>>>>>> maya site-packages directory:
>
> >>>>>>>>>>>  http://www.luma-pictures.com/tools/pymel/docs/1.0/install.html#manual
> >>>>>>>>>>> ...
>
> >>>>>>>>>>> let us know if that does not solve the problem.  there is another
> >>>>>>>>>>> variant to this 3rd option that we haven't fully explored, but
> >>>>>>>>>>> it would only
> >>>>>>>>>>> work for maya 2010, since .pth location restrictions were
> >>>>>>>>>>> relaxed in python
> >>>>>>>>>>> 2.6.
>
> >>>>>>>>>>> -chad
>
> >>>>>>>>>>> On Jan 20, 2010, at 10:34 PM, Count Zer0 wrote:
>
> >>>>>>>>>>>> Posting for Drew Skillman of DoubleFine from tech-artists.org
> >>>>>>>>>>>> forum:
>
> >>>>>>>>>>>> "We're running into some trouble with the new deployment
> >>>>>>>>>>>> scheme for
> >>>>>>>>>>>> 1.0. Specifically, pymel now needs to be imported prior to the
> >>>>>>>>>>>> maya
> >>>>>>>>>>>> libs, which means it needs to appear before those maya libs in
> >>>>>>>>>>>> sys.path.
>
> >>>>>>>>>>>> This is actually tricky to accomplish if you already have
> >>>>>>>>>>>> PYTHONPATH
> >>>>>>>>>>>> defined as an environment variable, and aren't in a position to
> >>>>>>>>>>>> change
> >>>>>>>>>>>> it. This is because if PYTHONPATH is defined, adding it to the
> >>>>>>>>>>>> maya.env does nothing (i'm using maya 2008 and carefully
> >>>>>>>>>>>> verified
> >>>>>>>>>>>> this).
>
> >>>>>>>>>>>> I can move the 2 necessary PyMel folders into the folder that's
> >>>>>>>>>>>> currently defined in PYTHONPATH, but that's pretty ugly since
> >>>>>>>>>>>> our
> >>>>>>>>>>>> maya
> >>>>>>>>>>>> tools are supposed to live elsewhere
>
> ...
>
> read more »

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

Reply via email to