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); |