Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

stop python script nodejs

var python_process;

router.get('/start_python', function(req, res) {
    var PythonShell = require('python-shell');
    var pyshell = new PythonShell('general.py');

    pyshell.end(function (err) {
        if (err) {
            console.log(err);
        }
    });
    python_process = pyshell.childProcess;

    res.send('Started.');
});

// this stops the process
router.get('/stop_python', function(req, res) {
   python_process.kill('SIGINT');
   res.send('Stopped');
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: const name value = event.target 
Javascript :: Make Floating label TextInput in react native 
Javascript :: array limit js 
Javascript :: convert UTC date to Indonesian local date format 
Javascript :: angular multiselect dropdown 
Javascript :: create cookie javascript react 
Javascript :: js editable table 
Javascript :: Automatic Slideshow in react js 
Javascript :: copia array javascript 
Javascript :: create video playlist using jquery 
Javascript :: Setting darkmode using Tailwind 
Javascript :: min max value javascript 
Javascript :: use of this keyword in js 
Javascript :: angular9 spy 
Javascript :: react routes multiple compoenents 
Javascript :: sum float values in jquery 
Javascript :: js get path from url 
Javascript :: exec in node js 
Javascript :: autocannon 
Javascript :: redirect to dashboard after login in vue 
Javascript :: javascript remove event listener after bind 
Javascript :: datatable set data of column 
Javascript :: react native pure component vs component 
Javascript :: sort object properties by value javascript 
Javascript :: uncaught exception javascript 
Javascript :: round down html 
Javascript :: find second smallest number in array javascript using for loop 
Javascript :: fsm2regex 
Javascript :: strupper in js 
Javascript :: react doc viewer 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =