python-shell icon indicating copy to clipboard operation
python-shell copied to clipboard

Passing a UID is not working

Open jxns opened this issue 3 years ago • 3 comments

The Question: I am trying to pass UID: 0 to the Python Shell in order to execute my script as root as recommended in #41 . But this only results in the following error:

Uncaught Exception: Error: spawn EPERM at ChildProcess.spawn (node:internal/child_process:412:11) at spawn (node:child_process:707:9) at new PythonShell (/home/pi/Desktop/app/node_modules/python-shell/index.js:127:55) at Function.run (/home/pi/Desktop/app/node_modules/python-shell/index.js:249:23) at IpcMainImpl. (/home/pi/Desktop/app/main.js:100:17) at IpcMainImpl.emit (node:events:390:28) at EventEmitter. (node:electron/js2c/browser_init:161:10780) at EventEmitter.emit (node:events:390:28)

I am using the following code:

PythonShell.run(arg, {uid: 2}, function(err, results){
});

Is there any way to run the child process with sudo privileges?

jxns avatar May 27 '22 09:05 jxns

Are you running your node script as root (sudo)?

Almenon avatar Sep 30 '22 03:09 Almenon

No. I am using Electron. Running Electron as root is not supported.

jxns avatar Sep 30 '22 06:09 jxns

https://github.com/electron/electron-packager/issues/647 might be helpful?

Almenon avatar Dec 17 '22 05:12 Almenon