Hi @bentraje just to be sure we are on the same page, c4dpy is nothing more than c4d lunched without GUI, but with a Python Interpreter, but in the end it's still a C4D standalone, so you need c4d to be installed.
If you really need to open a c4d file without Cinema 4D then you will need the Cineware Engine, which is a C++ library with his limitation since you can't execute or evaluate stuff only retrieve cached data when you save a project for Cineware. For more information look at Cineware Information Page.
Regarding your code this is kind of normal this is not working because as said previously c4dpy is a Cinema 4D stand-alone, so when you do os.startfile(file_path)
, this will execute the default application for a c4d file so Cinema 4D. Then just after that, you do a searchObject
, but you didn't load the document in the current context so this is normal nothing is found.
So instead of os.startfile
you should do a doc = c4d.documents.LoadDocument(file, c4d.SCENEFILTER_OBJECTS | c4d.SCENEFILTER_MATERIALS)
Then everything should work.
Cheers,
Maxime.