SOLVED Prevent c4d from opening path passed in sys.argv

Hi!

I want to do pretty much what was proposed in this thread. That is passing a script via sys.argv.
It seems that Cinema is trying to load the file after I'm done with my stuff and since it doesn't recognize the filetype I get an error "Unrecognized file format!".
I tried consuming the path with sys.argv.remove(path), but that didn't really seem to do anything.
How can I prevent Cinema from attempting to open the path?

Thanks!

Hi @Boony2000 unfortunately, Python can't consume/remove arguments.

But you could either add a variable so this way Cinema 4D will not try to load your file with something like
Cinema 4D.exe g_myvariable="filePath".

Cheers,
Maxime.

Hi @Boony2000 unfortunately, Python can't consume/remove arguments.

But you could either add a variable so this way Cinema 4D will not try to load your file with something like
Cinema 4D.exe g_myvariable="filePath".

Cheers,
Maxime.

Hi Maxime!
Thanks for your answer.
Is there a way to directly get that variable in Cinema, or is it basically just modifying the string into something that isn't recognized by Cinema? For me it looks like I now have to seperate the string by finding the '=' or something like that. Is that what I have to do?

You can use the argparse module.

Find an example Commandline.py.

Cheers,
Maxime.

Thanks! I'll try that.