Hello @Aeoll-0,
Thank you for reaching out to us. You should be a bit more specific about the circumstances and which you are using the command. As declared in our Support Guidelines, you should always post executable code, as we are otherwise are guessing what you are doing.
The self.filedir implies that this happens in a method, which in turn could mean that you are trying to do this off-main-thread. This is not allowed. I also gave it a spin myself, and for me it works.
Note that after the operation, the opened file is not the old file anymore. So, when you had a \data\a\myfile.c4d and saved to backup\a\, the opened file will be backup\a\myfile.c4d and not \data\a\myfile.c4d. Because of that, such newly "exported" documents will also induce thumbnail rendering. When you are trying to save many documents at once in this manner, the thumbnail rendering could make Cinema unresponsive. The path into which you want to dump things must also exist, Cinema 4D cannot create it for you.
I have tested this in 2023.2.2 and 2024.1.0 and found no problems in both versions.
Cheers,
Ferdinand
Result:
34f18c02-cc1d-42ef-94ac-d50f2ad57195-image.png
Code:
import c4d import os doc: c4d.documents.BaseDocument # The active document def main() -> None: """ """ # Cinema 4D cannot create the directory path for us, we must ensure that #path does exist. path: str = "e:\\projects\\foo\\" if not os.path.exists(path): os.makedirs(path) # Your settings. flags: int = (c4d.SAVEPROJECT_ASSETS | c4d.SAVEPROJECT_SCENEFILE | c4d.SAVEPROJECT_USEDOCUMENTNAMEASFILENAME) data: list = [doc, flags, path, [], []] # Invoke the command and raise errors on failure or missing assets. if not c4d.documents.SaveProject(*data): raise IOError(f"Could not save project to: '{path}'.") if data[4]: raise IOError(f"Failed to export the following assets: {data[4]}") # Success :) print (f"Successfully saved project to: '{path}', exporting the assets: {data[3]}.") if __name__ == '__main__': main()