Best way to distribute Python Script without exposing the source code


This is my first post. I’m new to Rhino and Python.
I’m writing a script in python using Rhino Python Editor and I would like to distribute it to my customers who are using both Windows and Mac versions of Rhino. But I would not like to expose the source code to them.


Probably one method would be to use the clr.CompileModules function.
Have a look at this function on these two pages, so you can have an idea on how it works:


Giulio Piacentino
for Robert McNeel & Associates

I compiled a dll file as shown on these websites but how do I call it form rhino? I created a following script:

import clr
import bracket

but it returns:
Message: No module named bracket

I am no expert - but I usually manage to get this to work. Is the file that you compiled called “”? That is the meaning of module here.


Giulio Piacentino
for Robert McNeel & Associates

Hello again
Sorry for late answer but I had a lot on my head lately.
So I am creating a script called

def tester():
    print 'Hello world’

then another one called

import clr
clr.CompileModules(“test.dll”, “”)

Then I run and it gives me test.dll

In next step I create to run it:

import clr
import test

and run it which gives me a result:
Message: No module named test

All the files are in a single folder AppData\Roaming\McNeel\Rhinoceros\5.0\scripts
Any help would be greatly appreciated.

has anyone gotten this error when trying to compile modules?

import clr
IOError: System.IO.IOException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

I am not sure what you are trying to do exactly (this discussion is 2 year old). A possibility is that the process does not have access to the local folder, or the .dll “testdll.dll” is already in use so it cannot be rewritten, or something similar.