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

    Content of PYTHONPATH not appended to sys.path

    Cinema 4D SDK
    python windows r20
    4
    5
    1.4k
    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.
    • H
      Heinrich Löwe
      last edited by Heinrich Löwe

      Hi, this is my first post in the new forum. I'm exited 😉

      I noticed, that the content of the PYTHONPATH environment variable is not appended to the content of sys.path for the c4d python interpreter. Since we use a lot of site-modules in our company, this issue is rather annoying.

      For the time being I helped myself by updating sys.path during plugin initialization, but I rather would not.

      # extend sys.path whit content of PYTHONPATH
      python_path = os.environ['PYTHONPATH'].replace("\\", "/").split(';')
      for entry in python_path:
          if not entry in sys.path:
              sys.path.append(entry)
      

      Is there a way to tackle the problem in a more convenient way, like a command line parameter or an environment variable? Is this behavior intended or is it just overlooked during the R20 upgrade process?

      I looking forward to your answers,
      Cheers,
      Heinrich.

      1 Reply Last reply Reply Quote 1
      • Y
        y_puech
        last edited by y_puech

        Hi Heinrich,

        Welcome to the new forum 😀

        PYTHONPATH not added to sys.path is a known issue and has been already fixed for the R20 SP2 update.
        I don't see a better workaround then your with R20 SP1 currently.

        I turned this topic into a Q&A. Please use this functionality in the future. For more information see Q&A New Functionality.

        Former MAXON SDK Engineer

        1 Reply Last reply Reply Quote 2
        • bnsB
          bns
          last edited by

          Hi,

          the issue is reappearing in R23.008, I'm wondering if this is a known one.

          thanks in advance,
          ben

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

            Hi, correct this is a known issue, I should have mentioned in the Changelog, I will update it next week.

            We removed the usage of PYTHONPATH since it's too problematic in case of multiple Cinema 4D versions installed and since PYTHONPATH can be used for a large variety of scripts that could not work in Python 3.7

            MAXON SDK Specialist

            Development Blog, MAXON Registered Developer

            bnsB 1 Reply Last reply Reply Quote 1
            • bnsB
              bns @m_adam
              last edited by

              @m_adam thanks for R23.110 C4DPYTHONPATH37 ! ❤

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