Compiling Python Plugin

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

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 🙂

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.

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?

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