Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Prevent c4d from opening path passed in sys.argv

    Cinema 4D SDK
    r20 python windows
    2
    5
    899
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      Boony2000
      last edited by

      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!

      1 Reply Last reply Reply Quote 0
      • M
        m_adam
        last edited by

        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.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • B
          Boony2000
          last edited by

          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?

          1 Reply Last reply Reply Quote 0
          • M
            m_adam
            last edited by

            You can use the argparse module.

            Find an example Commandline.py.

            Cheers,
            Maxime.

            MAXON SDK Specialist

            Development Blog, MAXON Registered Developer

            1 Reply Last reply Reply Quote 0
            • B
              Boony2000
              last edited by

              Thanks! I'll try that.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post