userSetup.py shared by many users\Pc

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

 
Thread Tools Display Modes
  02 February 2018
userSetup.py shared by many users\Pc

Hi everybody!
I'm working on some custom shelves in python...not a simple thing for me:-)
Is possible to have a single userSetup.py for many pc?...because in there i call the python script with the shelf and i would like it to work for all the users...does any of the maya search path overwrite the default search location for the userSetup.py file?
Thanks Alot!
Carlo
 
  02 February 2018
userSetup.py is a user settings file, so you wouldn't want to override that. It's not the right place to put scripts for shelves. Instead, put them in a module and import the module in the shelves.

For example, if your shared directory containing scripts is F:/Scripts, have users add this to userSetup.py:


import sys
path = ''F:/Scripts''
sys.path.append(''F:/Scripts'')


to add the script directory to the search path. Then you just import scripts in your shelf scripts:


def run(): 
 import helper_script
 helper_script.help()
run()


to import the F:/Scripts/helper_script.py module.

Maya modules are a more elegant way of doing it, but this works.
 
reply share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 09:05 AM.


Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.