   Weird error I'm getting with PyRun_SimpleFile()
  Here's my C++ code, it compiles fine, the file exists:#include <Python/python.h>#include <iostream>#include <cstdio>using namespace std;int main(int argc, char **argv){Py_Initialize();PyObject *main_module = PyImport_AddModule("__main__");PyObject *main_dict = PyModule_GetDict(main_module);FILE *f = fopen("test.py", "r");PyRun_SimpleFile(f, "test.py");if (PyDict_GetItemString(main_dict, "num") == NULL)cout << "No" << endl;elsecout << "Yes" << endl;Py_Finalize();return 0;}when I compile and run it, I get this:Unhandled exception at 0x7c918fea in Embed_practice.exe: 0xC0000005: Access violation writing location 0x00000010.and it calls attention to this line of code in a locked file in VS2005:/**** _lock_file - Lock a FILE**Purpose:*  Assert the lock for a stdio-level file**Entry:*  pf = __piob[] entry (pointer to a FILE or _FILEX)**Exit:**Exceptions:********************************************************************************/void __cdecl _lock_file (   FILE *pf   ){   /*    * The way the FILE (pointed to by pf) is locked depends on whether    * it is part of _iob[] or not    */   if ( (pf >= _iob) && (pf <= (&_iob[_IOB_ENTRIES-1])) )  /*   * FILE lies in _iob[] so the lock lies in _locktable[].   */  _lock( _STREAM_LOCKS + (int)(pf - _iob) );   else  /*   * Not part of _iob[]. Therefore, *pf is a _FILEX and the   * lock field of the struct is an initialized critical   * section.   */  EnterCriticalSection( &(((_FILEX *)pf)->lock) );}I'm not even sure what locking a file is, and I have no idea how to fix this.   
  From the Very High Level Layer section of the Python Embedding/Extending guide:Quote:Note also that several of these functions take FILE* parameters. On particular issue which needs to be handled carefully is that the FILE structure for different C libraries can be different and incompatible. Under Windows (at least), it is possible for dynamically linked extensions to actually use different libraries, so care should be taken that FILE* parameters are only passed to these functions if it is certain that they were created by the same library that the Python runtime is using.It's less fragile to read the file into a string and use PyRun_SimpleString() instead of PyRun_SimpleFile().   