Describe the bug
Uncaught TypeError when importing PythonShell in TS linker file for running python script from Electron app. This also happens when using CommonJS with const PythonShell = require('python-shell').
Python code
No relevant python code. Error happens at the moment of import
Javascript code
import { PythonShell } from 'python-shell';
and
const PythonShell = require('python-shell');
Expected behaviour
No error. Allowing for creating python instance and running script in new process.
Actual behavior
Error message displayed in console.
Uncaught TypeError: (0 , util_1.promisify) is not a function
at node_modules/python-shell/index.js (index.ts:39)
at __require (chunk-OL3AADLO.js?v=3f0bc4c7:9)
at dep:python-shell:1
Other Information (please complete the following information):
- OS: MacOS Ventura 13.0.1 (22A400) (M1 Macbook Pro)
- Python Version: Python 3.10.6
- Node Version: v18.7.0
Additional context
Package.json:
{
"name": "svelte-vite-electron",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"dev": "cross-env NODE_ENV=development elecrun --vite --preload preload.ts",
"preview": "npm build && cross-env NODE_ENV=production electron ./app/",
"build": "elecrun build --preload preload.ts && vite build",
"clean": "elecrun clean",
"pack": "npm run build && npm run rebuild && cross-env CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder -c ./electron-builder.yml --win --linux",
"pack:all": "npm run build && npm run rebuild && cross-env CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder -c ./electron-builder.yml --win --linux --mac",
"pack:win": "npm run build && npm run rebuild && cross-env CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder -c ./electron-builder.yml --win",
"pack:mac": "npm run build && npm run rebuild && cross-env CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder -c ./electron-builder.yml --mac",
"pack:linux": "npm run build && npm run rebuild && cross-env CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder -c ./electron-builder.yml --linux",
"rebuild": "electron-rebuild -m ./app",
"postinstall": "electron-builder install-app-deps",
"prettier": "prettier -w ."
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.10",
"@types/node": "^15.14.9",
"chalk": "^4.1.0",
"cross-env": "^7.0.3",
"electron": "^13.1.1",
"electron-builder": "^23.6.0",
"electron-rebuild": "^2.3.5",
"electron-run": "^2.0.1",
"esbuild": "^0.12.6",
"prettier": "^2.3.0",
"svelte": "^3.38.2",
"svelte-preprocess": "^4.7.3",
"ts-node": "^10.0.0",
"tslib": "^2.2.0",
"typescript": "^4.3.2",
"vite": "^3.2.5"
},
"dependencies": {
"fs-extra": "^10.0.0",
"python-shell": "^3.0.1"
}
}
Describe the bug
Uncaught TypeError when importing PythonShell in TS linker file for running python script from Electron app. This also happens when using CommonJS with const PythonShell = require('python-shell').
Python code
No relevant python code. Error happens at the moment of import
Javascript code
import { PythonShell } from 'python-shell';
and
const PythonShell = require('python-shell');
Expected behaviour
No error. Allowing for creating python instance and running script in new process.
Actual behavior
Error message displayed in console.
Uncaught TypeError: (0 , util_1.promisify) is not a function at node_modules/python-shell/index.js (index.ts:39) at __require (chunk-OL3AADLO.js?v=3f0bc4c7:9) at dep:python-shell:1Other Information (please complete the following information):
Additional context
Package.json:
{ "name": "svelte-vite-electron", "version": "0.0.0", "license": "MIT", "scripts": { "dev": "cross-env NODE_ENV=development elecrun --vite --preload preload.ts", "preview": "npm build && cross-env NODE_ENV=production electron ./app/", "build": "elecrun build --preload preload.ts && vite build", "clean": "elecrun clean", "pack": "npm run build && npm run rebuild && cross-env CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder -c ./electron-builder.yml --win --linux", "pack:all": "npm run build && npm run rebuild && cross-env CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder -c ./electron-builder.yml --win --linux --mac", "pack:win": "npm run build && npm run rebuild && cross-env CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder -c ./electron-builder.yml --win", "pack:mac": "npm run build && npm run rebuild && cross-env CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder -c ./electron-builder.yml --mac", "pack:linux": "npm run build && npm run rebuild && cross-env CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder -c ./electron-builder.yml --linux", "rebuild": "electron-rebuild -m ./app", "postinstall": "electron-builder install-app-deps", "prettier": "prettier -w ." }, "devDependencies": { "@sveltejs/vite-plugin-svelte": "^1.0.0-next.10", "@types/node": "^15.14.9", "chalk": "^4.1.0", "cross-env": "^7.0.3", "electron": "^13.1.1", "electron-builder": "^23.6.0", "electron-rebuild": "^2.3.5", "electron-run": "^2.0.1", "esbuild": "^0.12.6", "prettier": "^2.3.0", "svelte": "^3.38.2", "svelte-preprocess": "^4.7.3", "ts-node": "^10.0.0", "tslib": "^2.2.0", "typescript": "^4.3.2", "vite": "^3.2.5" }, "dependencies": { "fs-extra": "^10.0.0", "python-shell": "^3.0.1" } }