include variable in ejs blocks :unexpected token error % - node.js

I am trying to append a variable with block in ejs
this is my variable <%=sails.config.items.base_url%>
<%block('searchScript','<script src='<%=sails.config.items.base_url%>'></script>')%>
But i got the following error
"stack": "SyntaxError: Unexpected token %= in \"/var/www/node/cushbuart/views/user/edit-art.ejs\"\n

Try this
<%=sails.config.items.base_url%>
<%block('searchScript','<script src='+ sails.config.items.base_url +'></script>')%>

Related

React js Failed to compile Errer

I moved to windows 11 from Linux , so i imported all my code from Linux..to windows . So whenever i try to run a react project , I get a compile error stating :-
`
./src/Componets/shop/products.JSON
Module parse failed: Unexpected token m in JSON at position 0 while parsing near 'module.exports = __w...'
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token m in JSON at position 0 while parsing near 'module.exports = __w...'
at JSON.parse (<anonymous>)
`

Python Dictionary - Invalid Syntax

Why does the following code throw an invalid syntax error?
grads = {"dW1": dW1,
"db1": db1,
"dW2": dW2,
"db2": db2}
It gives the following error
File "<ipython-input-27-f129b09e7ac8>", line 40
grads = {"dW1": dW1,
^
SyntaxError: invalid syntax
There is nothing wrong with the scope you are sharing. You have a syntax error above / before declaring grads

api response contains escape characters

I am getting value from API response as below
{
"ORG_ID":"165",
"DEPOT_NAME":"Pesto",
"DEPOT_SHORT_NAME":"PSD",
"PROD_ID":"709492",
"DESCRIPTION":"EX CL (2X14) U17\SH36\5",
"PRICE":"3708.55",
"STOCK":"2"
},
now when I am parsing it in json like json.parse(response) it cashes the app.. error is below:
undefined:11
"DESCRIPTION":"EXELON HGC 4.5MG (2X14) U17\SH36\5",
^
SyntaxError: Unexpected token S in JSON at position 296
What should I do to get rid of these escapes.
though I need the same values I don't want to change any value or remove these slashes.
You need to escape the special characters before parsing the jSON.
In this case for it to be valid it should be:
{
"ORG_ID":"165",
"DEPOT_NAME":"Pesto",
"DEPOT_SHORT_NAME":"PSD",
"PROD_ID":"709492",
"DESCRIPTION":"EX CL (2X14) U17\\SH36\\5",
"PRICE":"3708.55",
"STOCK":"2"
}

Syntax error when trying to input errors for a set of data

I'm trying to create a graph using Jupyter Notebooks but when I input errors for a data set "syntax error" appears referring to the word error, any ideas on the problem?
measured_time2 = q.MeasurementArray(
data = [0,0.2,1.0,2.2,4.0,6.2,9.0,12.2,16.0,20.2,25]
error = [0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1])
File "<ipython-input-36-96c22be70112>", line 8
error = [0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1])
^
SyntaxError: invalid syntax

"Generator already running" message on any error

I have a very simple generator function, like this
exports.whatever = function *(next) {
this.body = 'wow';
z
};
Now, there obviously is a syntax error here ('z' on the third line),
but with koa's generators, the error I get in the console is basically useless for debugging; I do not get the line of the error, the file, or even the type of error. All I get is:
Error: Generator is already running
at GeneratorFunctionPrototype.next (native)
at onFulfilled (/Users/johndoe/Documents/nodejs/testing/node_modules/koa/node_modules/co/index.js:59:19)
at /Users/johndoe/Documents/nodejs/testing/node_modules/koa/node_modules/co/index.js:48:5
at Object.co (/Users/johndoe/Documents/nodejs/testing/node_modules/koa/node_modules/co/index.js:47:10)
at Object.toPromise (/Users/johndoe/Documents/nodejs/testing/node_modules/koa/node_modules/co/index.js:112:63)
at next (/Users/johndoe/Documents/nodejs/testing/node_modules/koa/node_modules/co/index.js:93:29)
at onRejected (/Users/johndoe/Documents/nodejs/testing/node_modules/koa/node_modules/co/index.js:79:7)
Is there any way to see the real detail of the error? Thanks in advance.

Resources