Maya userSetup.py conflict with userPrefs.mel

Hello there,

Is there a maya grunt scripter here, who can solve this :

Pb= set maya to 25fps even if someone delete locally the maya prefs
Info = all maya are pointing to a server via maya.env.

I tried to :
A) code in userSetup.py (set the values directly)
import maya.cmds as mc
mc.currentUnit(t=“pal”)
print mc.currentUnit(q=True,t=True)

the output window print “pal” but it isn’t in maya (still 24fps)

 B) code in userSetup.py (copy a file from serv to local)

import shutil
src=“PathOnServ\userPrefs.mel”
trg=“PathLocal\prefs”
shutil.copy(src,trg)

but maya overwrite the file with the default one (I tested my code with a .py and it works)
Any idea ?

usersetup sources before the prefs hence the issue. you can probably work around it by running an evalDeffered command

What dgovil says. You need to use evalDeffered. The python version of userSetup evals early in the Maya startup, before all systems have been created. Compared to the MEL version which evaluates later in the startup.

We set the time at startup in a python userSetup with evalDeffered at Ava and it works fine.

thank you Dgovil and Wolf , it works perfectly. Problem solved.