How to "include" .pyp filies inside a .pyp file?

On 29/05/2013 at 14:55, xxxxxxxx wrote:

I'm coding a plugin and it is a .pyp file.
But since it is a very complex plugin, I want to separate different parts of it into independent .pyp files
When I was using COFFEE, I would create .h files and then, in my main .cof files, I would simply include them with something like:

include "aux.h"

So, how is that done in python? I tried using the import command but it doesn't seems to be working.

Rui Batista

On 29/05/2013 at 15:05, xxxxxxxx wrote:

Is this what you want?:


On 29/05/2013 at 15:31, xxxxxxxx wrote:

YES!!! :-)
Thank you.
However, when I tried to run the "Source Protector..." command on the .py file that is the file that I'm importing, the protection fails.
Is it possible to protect the source code of the imported module?

On 29/05/2013 at 16:27, xxxxxxxx wrote:

I think I remember someone asking that same question. And the answer was it's not possible.
But I could be wrong.


On 29/05/2013 at 16:28, xxxxxxxx wrote:

I hope you are wrong ;-)

I thought that python was more powerful than COFFEE. If this is not possible it is a major drawback :-(

On 29/05/2013 at 17:36, xxxxxxxx wrote:

You can compile Python code to .pyc files. Hit google for it, there's plenty of information about it.
The compilation of .pyp to .pype files differs from this, the Source Protector can not be used interchangibly
with the normal Python bytecode translator.


On 30/05/2013 at 04:47, xxxxxxxx wrote:

I finally managed to compile a .pyc file from the .py file.
But, when starting Cinema4D, I get a Bad Magic Number error.
I believe this is due to the version of the compiler.
So, how can I compile the .py file in a version that is compatible with the version that Cinema4D uses?

On 30/05/2013 at 04:53, xxxxxxxx wrote:

Have you used CPython 2.6? Use this version or you can even use the python binary in the Cinema
resource folder under modules/python/Python.<Your OS>.Framework/.

On 30/05/2013 at 05:08, xxxxxxxx wrote:

Oh, I used the version that comes with Mac OS 10.8

So, I went to the Terminal, changed to the directory where my .py file is. Then I dragged the Python.osx into the Terminal prompt to execute it. But I got a Permission denied error :-(
Am I doing something wrong?

On 30/05/2013 at 05:24, xxxxxxxx wrote:

I'm not a Unixman, but my guess is that your Python binary is not executable. You can change this
via the right click > properties or use    sudo chmod +x ThePythonExecutableFileName   .


On 30/05/2013 at 05:37, xxxxxxxx wrote:

It worked.
And I was able to compile the .py file into a .pyc file.
But when I try to start Cinema4D, it crashes :-(

On 30/05/2013 at 10:33, xxxxxxxx wrote:

If it crashes, pls send maxon the crash report with some background information.


Cheers, Sebastian