sbinet/go-python — pull request #16 by tfogal (2014-11-27 13:37:48+00:00)
Title: Module and high-level interface to executing a python script

My project creates a "python" module, auto-imports it into the current python context/interpreter, and then runs a script (which presumably accesses the module I created). This implements the machinery that was missing for me to do this via go-python.

One thing of potential note/issue is that I have slightly changed the syntax of PyRun_SimpleFile. The original API takes an already-opened FILE*. However, since this is a huge pain in Go, I stepped around the issue by having it take only a file name. While one can, in C, re-execute the same python script simply by fopen(3)ing the .py file once and rewind(3)ing it for every execution, my approach here means this is not possible in Go: the file must be opened anew for each execution.

This is fine for my uses; is it correct for go-python, though?