MCPcopy Create free account
hub / github.com/Surfer-Org/Protocol / runPythonScript

Method runPythonScript

desktop/src/main/helpers/python.ts:141–164  ·  view source on GitHub ↗
(scriptPath: string, mainWindow: BrowserWindow)

Source from the content-addressed store, hash-verified

139 }
140
141 async runPythonScript(scriptPath: string, mainWindow: BrowserWindow) {
142 const pythonPath = this.SurferPythonPath;
143
144 const pythonProcess = spawn(pythonPath, [scriptPath]);
145
146 pythonProcess.stdout.on('data', (data) => {
147 console.log(`stdout: ${data}`);
148 console.log('sending to renderer');
149 console.log(data.toString());
150 mainWindow.webContents.send('script-data', data.toString());
151 });
152
153 pythonProcess.stderr.on('data', (data) => {
154 console.error(`stderr: ${data}`);
155 console.log('sending to renderer');
156 console.log(data.toString());
157 mainWindow.webContents.send('script-error', data.toString());
158 });
159
160 pythonProcess.on('close', (code) => {
161 console.log(`child process exited with code ${code}`);
162 mainWindow.webContents.send('script-completed');
163 });
164 }
165
166 async executePythonScript(
167 script: string,

Callers

nothing calls this directly

Calls 1

onMethod · 0.80

Tested by

no test coverage detected