Issue - Opening a scene with Python, unsaved changes

Issue - Opening a scene with Python, unsaved changes

Anonymous
Not applicable
3,390 Views
1 Reply
Message 1 of 2

Issue - Opening a scene with Python, unsaved changes

Anonymous
Not applicable

Hello all,

 

So as of lately I'm unable to open scenes with Python (or Mel).

I keep getting a warning that my scene had unsaved changes and then it fails to open the scene.

I flush the scene first, and then open.

 

I also tried deleting my prefs and re-installing Maya. But none of it worked.

 

Anybody knows what's going on here?

 

I use something like this:

 

from maya import cmds
file_path = "/Users/David/Desktop/SH003SCENE_v001.mb"
cmds.file(new=True, force=True) 
cmds.file(file_path, open=True)
0 Likes
3,391 Views
1 Reply
Reply (1)
Message 2 of 2

hannesdelbeke
Enthusiast
Enthusiast

this will do the trick (untested)

cmds.file(file_path, open=True, force=True) 

or in pymel (tested)

pm.openFile(scene_path, force=True) 


when i create a new scene in maya, maya sees the scene as changed despite me not touching it.
you can see this if a * appears in the window title 
the command you run creates a new scene so i would assume the same happening there 

cmds.file(new=True, force=True) 


i did notice i had a security issue which might be the cause of this,
so make sure the maya security tools plugin is installed. 
it can be found here https://apps.autodesk.com/MAYA/en/Detail/Index?id=8637238041954239715&appLang=en&os=Linux

0 Likes