JSPyBridge
JSPyBridge copied to clipboard
using python.exit() with import statement
First of all, thank you for creating a nice library. I'm using it well.
However, I face unexpected error when I use JSPyBridge in typescript.
here is code
import { py, python } from 'pythonia'
// const { py, python } = require('pythonia')
export async function getSkewNorm() {
const ag = await python('antigravity')
const lorem = await py`print('testing ')`
python.exit() // error : Property 'exit' does not exist on type '(fileName: string) => any'.ts(2339)
}
this error goes down If I use require instead of import. but I don't want to ruin unity.
can you give me an advice for this?? thanks
might be late but the following worked for me on typescript
import { python } from 'pythonia';
function doSomething(){
const pyScript = await python([process.cwd(), 'pages', 'api', 'getyoutubevidlist.py'].join('\\'));
const start = Date.now();
let result = await pyScript.get_youtube_vid_list();
if (isLocal)
console.log(result);
(python as any).exit();
}