How to use pythonnet - 3 common examples

To help you get started, we’ve selected a few pythonnet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fkarb / pythonnet_old / pythonnet / demo / View on Github external
def main():
    form = HelloApp()
    print "form created"
    app = WinForms.Application
    print "app referenced"
github pythonnet / pythonnet / pythonnet / View on Github external
retcode = process.poll()
    if retcode:
        cmd = kwargs.get("args")
        if cmd is None:
            cmd = popenargs[0]
        raise CalledProcessError(retcode, cmd, output=output)
    return output

if __name__ == "__main__":
            Extension("clr", sources=[])
          cmdclass = {
            "build_ext" : PythonNET_BuildExt
github pythonnet / pythonnet / pythonnet / View on Github external
def build_extension(self, ext):
        Builds the .pyd file using msbuild or xbuild.
        if != "clr":
            return super(PythonNET_BuildExt, self).build_extension(ext)

        dest_file = self.get_ext_fullpath(
        dest_dir = os.path.dirname(dest_file)
        if not os.path.exists(dest_dir):

        defines = [
            "PYTHON%d%s" % (sys.version_info[:2]),
            "UCS2" if sys.maxunicode < 0x10FFFF else "UCS4",

        if CONFIG == "Debug":
            defines.extend(["DEBUG", "TRACE"])

        cmd = [


.NET and Mono integration for Python

Latest version published 1 month ago

Package Health Score

88 / 100
Full package analysis

Popular Python code snippets

Find secure code to use in your application or website