Hey folks,

I've setup a sitecustomize.py script which is located in a Maya module path
to customise our Maya setup on launch

It basically queries a custom Maya environment variable located in the *
maya.env* called "*PYTHON_SITEPACKAGES*" with
the following path: "*D:/pipeline_tools/python/site-packages/*"

(I've not used the PYTHONPATH on purpose so we can customise the packages
for each version of maya without affecting the
standard paths - the script inserts them basically)

What it does is look at the path and add the "packages" from the folder
name.
The folder has these package folders:
D:/pipeline_tools/python/site-packages/:
                                                         pymel_1.0.0rc2
                                                         pyodbc-2.1.7

I'm trying to extend what I have currently setup for our Maya 2010 setup so
that can check the Maya version and tailor the
packages appropriately, for example Maya 2011 overriding pymel with newer
versions without having to install it to every users machine.

If this sounds whacky and crazy please tell me :) I am new to python and its
wonderful ways.

I've chosen the sitecustomize.py method because I can insert packages and
only have to maintain one path in the Maya.env
instead of having to manage lots of .pth files etc etc

Anyway onto the problem, if I try and use maya.cmds in the sitecustomize.py
I always get a warning(?) in the maya
output window: *'import site' failed; use -v for traceback*

The sitecustomize.py is as follows:

import sys
import os
import maya.cmds as cmds

version = cmds.about(v=True)

path = os.environ.get ("PYTHON_SITEPACKAGES")
pathExists = os.path.exists(path)

if(pathExists):
    sitePackages = os.listdir(path)

    for package in sitePackages:
        sitePath = os.path.join(path, package)
        print '*** Inserting package: %s from path: %s' % (package,
sitePath)
        sys.path.insert(0,sitePath)

If I remove the version check the script process properly even though the
import maya.cmds as cmds is still there.

Is it because the maya.cmds are not "active" properly at this early stage
(only the output window is open)?

Any help would be appreciated :)

Thanks
Dave Shaw

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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to