node js correct code giving error about syntex Announcing the arrival of Valued Associate...
How do pianists reach extremely loud dynamics?
How do I keep my slimes from escaping their pens?
Output the ŋarâþ crîþ alphabet song without using (m)any letters
Check which numbers satisfy the condition [A*B*C = A! + B! + C!]
Understanding Ceva's Theorem
Should I use a zero-interest credit card for a large one-time purchase?
Why do we bend a book to keep it straight?
The logistics of corpse disposal
If a contract sometimes uses the wrong name, is it still valid?
Can I cast Passwall to drop an enemy into a 20-foot pit?
Why aren't air breathing engines used as small first stages
List of Python versions
How to deal with a team lead who never gives me credit?
Novel: non-telepath helps overthrow rule by telepaths
How do I stop a creek from eroding my steep embankment?
Is it true that "carbohydrates are of no use for the basal metabolic need"?
Echoing a tail command produces unexpected output?
What does the "x" in "x86" represent?
51k Euros annually for a family of 4 in Berlin: Is it enough?
What's the meaning of 間時肆拾貳 at a car parking sign
When a candle burns, why does the top of wick glow if bottom of flame is hottest?
Why am I getting the error "non-boolean type specified in a context where a condition is expected" for this request?
Denied boarding although I have proper visa and documentation. To whom should I make a complaint?
First console to have temporary backward compatibility
node js correct code giving error about syntex
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Best way to handle the error in async nodeNode exports, architectureNode PSP ISO ScraperNode Automation ProjectJavascript node/react web developer interview codeHello World Node application with error handlingNode JS routing systemNode secure randomness implementationsError handling for a simple 'fetch some data, then save the data' Node functionNode websockets
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
$begingroup$
I have this working code. But after longtime when I rerun I am getting error. I am not sure Am I making mistake in running or what.
const express = require('express');
const bodyParser = require('body-parser');
const url = require('url');
const querystring = require('querystring');
const fs = require('fs');
let {PythonShell} = require('python-shell')
let app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.get('/ip/predict', async function(req, res) {
let data = req.query.data;
console.log(data)
fs.writeFile("data.csv", data, function(err) {
if(err) {
return console.log(err);
}
});
var options = {
args: ['data']
}
PythonShell.run('my_script.py', options, function (err, results) {
if (err) throw err;
console.log('results: %j', results);
var pred = { "prediction":results }
res.send(pred)
});
});
let server = app.listen(8080, function() {
console.log('Server is listening on port 8080')
});
When I run this code using command
node app_express.js
it gives
/home/admin/node_code/testapp/app_express.js:11
app.get('/ip/predict', async function(req, res) {
^^^^^
SyntaxError: missing ) after argument list
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.runMain (module.js:611:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:160:9)
Anything wrong with the code or running command?
node.js
New contributor
$endgroup$
add a comment |
$begingroup$
I have this working code. But after longtime when I rerun I am getting error. I am not sure Am I making mistake in running or what.
const express = require('express');
const bodyParser = require('body-parser');
const url = require('url');
const querystring = require('querystring');
const fs = require('fs');
let {PythonShell} = require('python-shell')
let app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.get('/ip/predict', async function(req, res) {
let data = req.query.data;
console.log(data)
fs.writeFile("data.csv", data, function(err) {
if(err) {
return console.log(err);
}
});
var options = {
args: ['data']
}
PythonShell.run('my_script.py', options, function (err, results) {
if (err) throw err;
console.log('results: %j', results);
var pred = { "prediction":results }
res.send(pred)
});
});
let server = app.listen(8080, function() {
console.log('Server is listening on port 8080')
});
When I run this code using command
node app_express.js
it gives
/home/admin/node_code/testapp/app_express.js:11
app.get('/ip/predict', async function(req, res) {
^^^^^
SyntaxError: missing ) after argument list
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.runMain (module.js:611:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:160:9)
Anything wrong with the code or running command?
node.js
New contributor
$endgroup$
add a comment |
$begingroup$
I have this working code. But after longtime when I rerun I am getting error. I am not sure Am I making mistake in running or what.
const express = require('express');
const bodyParser = require('body-parser');
const url = require('url');
const querystring = require('querystring');
const fs = require('fs');
let {PythonShell} = require('python-shell')
let app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.get('/ip/predict', async function(req, res) {
let data = req.query.data;
console.log(data)
fs.writeFile("data.csv", data, function(err) {
if(err) {
return console.log(err);
}
});
var options = {
args: ['data']
}
PythonShell.run('my_script.py', options, function (err, results) {
if (err) throw err;
console.log('results: %j', results);
var pred = { "prediction":results }
res.send(pred)
});
});
let server = app.listen(8080, function() {
console.log('Server is listening on port 8080')
});
When I run this code using command
node app_express.js
it gives
/home/admin/node_code/testapp/app_express.js:11
app.get('/ip/predict', async function(req, res) {
^^^^^
SyntaxError: missing ) after argument list
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.runMain (module.js:611:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:160:9)
Anything wrong with the code or running command?
node.js
New contributor
$endgroup$
I have this working code. But after longtime when I rerun I am getting error. I am not sure Am I making mistake in running or what.
const express = require('express');
const bodyParser = require('body-parser');
const url = require('url');
const querystring = require('querystring');
const fs = require('fs');
let {PythonShell} = require('python-shell')
let app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.get('/ip/predict', async function(req, res) {
let data = req.query.data;
console.log(data)
fs.writeFile("data.csv", data, function(err) {
if(err) {
return console.log(err);
}
});
var options = {
args: ['data']
}
PythonShell.run('my_script.py', options, function (err, results) {
if (err) throw err;
console.log('results: %j', results);
var pred = { "prediction":results }
res.send(pred)
});
});
let server = app.listen(8080, function() {
console.log('Server is listening on port 8080')
});
When I run this code using command
node app_express.js
it gives
/home/admin/node_code/testapp/app_express.js:11
app.get('/ip/predict', async function(req, res) {
^^^^^
SyntaxError: missing ) after argument list
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.runMain (module.js:611:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:160:9)
Anything wrong with the code or running command?
node.js
node.js
New contributor
New contributor
New contributor
asked 6 mins ago
user2129623user2129623
99
99
New contributor
New contributor
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "196"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
user2129623 is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f217604%2fnode-js-correct-code-giving-error-about-syntex%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
user2129623 is a new contributor. Be nice, and check out our Code of Conduct.
user2129623 is a new contributor. Be nice, and check out our Code of Conduct.
user2129623 is a new contributor. Be nice, and check out our Code of Conduct.
user2129623 is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Code Review Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f217604%2fnode-js-correct-code-giving-error-about-syntex%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown