Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using python.exit() with import statement #63

Open
SpookyJelly opened this issue Sep 16, 2022 · 1 comment
Open

using python.exit() with import statement #63

SpookyJelly opened this issue Sep 16, 2022 · 1 comment

Comments

@SpookyJelly
Copy link

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

@petrosmm
Copy link

petrosmm commented Mar 8, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants