Skip to content

Commit 0eaa025

Browse files
committed
code refinements
1 parent fb0c34b commit 0eaa025

File tree

9 files changed

+105
-782
lines changed

9 files changed

+105
-782
lines changed

javascript/package-lock.json

+21-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

javascript/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"keywords": [],
99
"author": "",
1010
"license": "ISC",
11-
"description": "",
1211
"dependencies": {
13-
"python-shell": "^3.0.0"
14-
}
12+
"python-shell": "^3.0.1"
13+
},
14+
"description": ""
1515
}

javascript/pynode.js

+16-8
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ const maxAPI = require("max-api");
1010
//Max.post(`Loaded the ${path.basename(__filename)} script`);
1111

1212

13+
PythonShell.runString('x=1+1;print(x)', null, function (err) {
14+
if (err) throw err;
15+
console.log('python execution finished');
16+
});
17+
1318
let options = {
1419
mode: 'text',
1520
pythonPath: '/usr/local/bin/python3',
@@ -19,7 +24,9 @@ let options = {
1924
};
2025

2126

22-
let pyshell = new PythonShell('hello.py');
27+
// let pyshell = new PythonShell('hello.py');
28+
29+
let pyshell = new PythonShell('test_pynode.py');
2330

2431
//import {PythonShell} from 'python-shell';
2532
// let pyshell = new PythonShell('pipeline.py');
@@ -59,14 +66,15 @@ const handlers = {
5966
}
6067
}
6168

62-
maxAPI.addHandlers(handlers);
6369

6470
// Use the 'addHandler' function to register a function for a particular message
65-
//Max.addHandler("bang", () => {
66-
// Max.post("Who you think you bangin'?");
67-
//});
71+
maxAPI.addHandler("bang", () => {
72+
maxAPI.post("Who you think you bangin'?");
73+
});
6874

6975
// Use the 'outlet' function to send messages out of node.script's outlet
70-
//Max.addHandler("echo", (msg) => {
71-
// Max.outlet(msg);
72-
//});
76+
maxAPI.addHandler("echo", (msg) => {
77+
maxAPI.outlet(msg);
78+
});
79+
80+
maxAPI.addHandlers(handlers);

0 commit comments

Comments
 (0)