saving project with python in 2.54

hi all,

I am trying to migrate some of my scripts to 2.54. I want to find a way to use python to from the command line to make changes to a blender file and then save that blender file.

Note that I am not actually loading the blender UI, but I am just launching blender from the command line with the “-P” argument to a python script.

I was able to do this fairly easily under 2.49 with the following

filename = Blender.Get("filename");
Blender.Save(filename, 1);

I thought I could use 2.54’s bpy.ops.wm.save_as_mainfile(), but that seems to only work if the UI is loaded. And the same script, run from the command line outside of the UI. It simply does not save the file if I only run this from the command line with the “-P” argument (which kind of makes sense because I assume wm stands for window manager, which would not be there without the UI).

So, any words of wisdom from anyone? Also, I do like the changes in the python with 2.5… nice work guys!