63 |
/** |
/** |
64 |
Create a filename base on a partial filename. In that case of python, this |
Create a filename base on a partial filename. In that case of python, this |
65 |
just means adding '.py' to the end. |
just means adding '.py' to the end. |
66 |
|
|
67 |
@param partialname the filename without suffix, as specified in the user's "IMPORT" command |
@param partialname the filename without suffix, as specified in the user's "IMPORT" command |
68 |
@return new filename, or NULL on failure |
@return new filename, or NULL on failure |
69 |
*/ |
*/ |
74 |
ERROR_REPORTER_HERE(ASC_PROG_ERR,"Partial name is NULL, can't work out filename"); |
ERROR_REPORTER_HERE(ASC_PROG_ERR,"Partial name is NULL, can't work out filename"); |
75 |
return NULL; |
return NULL; |
76 |
} |
} |
77 |
|
|
78 |
len = strlen(partialname); |
len = strlen(partialname); |
79 |
name = ASC_NEW_ARRAY_CLEAR(char,len+4); |
name = ASC_NEW_ARRAY_CLEAR(char,len+4); |
80 |
strcpy(name,partialname); |
strcpy(name,partialname); |
99 |
}else{ |
}else{ |
100 |
CONSOLE_DEBUG("INITIALISING PYTHON"); |
CONSOLE_DEBUG("INITIALISING PYTHON"); |
101 |
Py_Initialize(); |
Py_Initialize(); |
102 |
|
CONSOLE_DEBUG("COMPLETED ATTEMPT TO INITIALISE PYTHON"); |
103 |
|
} |
104 |
|
|
105 |
|
if(!Py_IsInitialized()){ |
106 |
|
CONSOLE_DEBUG("UNABLE TO INITIALIZE PYTHON"); |
107 |
|
return 1; |
108 |
} |
} |
109 |
|
PyRun_SimpleString("print \"HELLO FROM PYTHON IN C\""); |
110 |
|
|
111 |
PyRun_SimpleString("import ascpy"); |
PyRun_SimpleString("import ascpy"); |
112 |
f = fopen(name,"r"); |
f = fopen(name,"r"); |