/[ascend]/trunk/models/johnpye/extpy/extpy.c
ViewVC logotype

Diff of /trunk/models/johnpye/extpy/extpy.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 869 by johnpye, Wed Oct 4 14:03:46 2006 UTC revision 871 by johnpye, Thu Oct 5 09:30:08 2006 UTC
# Line 141  int extpy_import(const struct FilePath * Line 141  int extpy_import(const struct FilePath *
141          return 1;          return 1;
142      }      }
143      PyRun_SimpleString("print \"HELLO FROM PYTHON IN C\"");      PyRun_SimpleString("print \"HELLO FROM PYTHON IN C\"");
144        CONSOLE_DEBUG("IMPORTING ASCPY...");
145      PyRun_SimpleString("import ascpy");      PyRun_SimpleString("import ascpy");
146        CONSOLE_DEBUG("CREATING LIBRARY OBJECT...");
147      PyRun_SimpleString("L = ascpy.Library()");      PyRun_SimpleString("L = ascpy.Library()");
148        CONSOLE_DEBUG("PRINTING MESSAGE...");
149      PyRun_SimpleString("print \"IMPORTED ASCPY\"");      PyRun_SimpleString("print \"IMPORTED ASCPY\"");
150      PyRun_SimpleString("print L");      PyRun_SimpleString("print L");
151    
152      initextpy();      initextpy();
153    
154        CONSOLE_DEBUG("OPENING THE SCRIPT \"%s\"",name);
155      f = fopen(name,"r");      f = fopen(name,"r");
156        if(f==NULL){
157            CONSOLE_DEBUG("Failed opening script");
158            ERROR_REPORTER_HERE(ASC_PROG_ERR,"UNABLE TO OPEN SCRIPT");
159            return 1;
160        }
161        CONSOLE_DEBUG("RUNNING THE SCRIPT");
162      PyRun_AnyFile(f,name);      PyRun_AnyFile(f,name);
163        CONSOLE_DEBUG("FINISHED RUNNING THE SCRIPT");
164    
165      fclose(f);      fclose(f);
166    
167      ASC_FREE(name);      ASC_FREE(name);

Legend:
Removed from v.869  
changed lines
  Added in v.871

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22