title: how can i embed python in c?
body: <p>i wrote the C code as follow:</p>
  
  <pre><code>int main(int argc, char** argv)
  
  {
  
      PyObject *mod, *name, *func;
      Py_Initialize();
      mod = PyImport_ImportModule("perf_tester");
      if(!mod)
      {
          printf("cannot find perf_tester.py");
          getchar();
          return -1;
      }
      name = PyObject_GetAttrString(mod, "CheckSharpness");
      if(!name)
      {
          printf("can not find CheckSharpness");
          getchar();
          return -1;
      }
      func = PyObject_GetAttrString(name,"F");
      if(!func)
      {
          printf("can not find function");
          getchar();
          return -1;
      }
      Py_Finalize();
      system("pause");
      return 0;
  }
  </code></pre>
  
  <p><strong><em>except for func, i could find mod and name.</em></strong></p>
  
  <p>and the partial of the perf_tester.py as follow:</p>
  
  <pre><code>def CheckSharpness(sample, edges, min_pass_mtf, min_pass_lowest_mtf,
             use_50p, mtf_sample_count, mtf_patch_width,
             mtf_crop_ratio=_MTF_DEFAULT_CROP_RATIO,
             n_thread=1):
  
    mtfs = [mtf_calculator.Compute(sample, line_start[t], line_end[t],
                                     mtf_patch_width, mtf_crop_ratio,
                                     use_50p)[0] for t in perm]
  
    F = open("data.txt","w")
    F.write(str(mtfs))
    F.close()
  </code></pre>
  
  <p>what could I do? </p>