Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    Compiling Python Plugin

    Scheduled Pinned Locked Moved PYTHON Development
    5 Posts 0 Posters 531 Views
    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 Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 28/06/2012 at 01:53, xxxxxxxx wrote:

      I'm aware you can use the source protector to protect a single .pyp file.

      but what if the .pyp references other .py files, how do I compile all these files together?

      I've used python -m compileall, but when I import the files into the plugin folder and launch cinema I get

      ImportError: Bad magic number in /Applications/MAXON/CINEMA 4D R13/plugins/Plugin/package/__init__.pyc

      seems like the compiled pyc files aren't working

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 28/06/2012 at 02:29, xxxxxxxx wrote:

        update:

        I've been trying to use the python executable in resource/modules/python/res/Python.osx.framework/

        as i knew the version of python I had installed was 2.7, and I'm aware that cinema supports 2.6

        cinema still didn't like my .pyc files

        so looked at how i could target python2.6 instead and came across http://www.activestate.com/activepython/

        install that and you can type python2.6 into the terminal. then i just did

          
        import compileall  
        compileall.compile_dir('path/to/plug', force=True)  
        

        the files compiled and cinema read them properly with no errors!

        hope that helps someone 🙂

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 28/06/2012 at 06:50, xxxxxxxx wrote:

          Thanks for sharing your solution.

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 07/07/2012 at 11:45, xxxxxxxx wrote:

            I tried this an I get a:

            "Can't list" error, followed by the provided path.

            I assume I need to provide the folder path where my .py files are and that the path needs to be provided between the '', right?

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 08/07/2012 at 01:09, xxxxxxxx wrote:

              You need to specify the complete path to the folder. Py4D's cwd is root and the OS assumes that your relative path can be made absolute by joining the CWD and your path, but I don't think your plugin is in

              /path/to/plug
              

              , is it?

              You get "ba magic number error" because the version of your installed Python interpreter is not 2.6. Either install CPython 2.6 and run -m compileall, or switch to the CPython version that is delivered with every Cinema 4D distribution.

              -Nik

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