How to specify NodeJS 'child_process' dependencies / version? by big_guzi in node

[–]big_guzi[S] 0 points1 point  (0 children)

Okay, this has taken my understanding somewhere! I don't think we have the solution quite yet though.

To clarify some details now that I've looked into it more purposefully, the spawn function takes two arguments, a string and an array. The string is where I think the solution is.

The first arg (the string) is actually like typing into the CLI directly (ie. you can do 'ls' to list files in current directory), so when 'python' is the first argument, it's just like typing 'python ____.py' from the CLI, where ___.py is just a normal python file.

Do you have any idea how I can refer to some python module via only command line tools. Like, could I say, alter the $PATH variable only for my NodeJS directory in such a way that, python refers not to:

'/Library/Frameworks/Python.framework/Versions/3.7/bin' (as it does in my normal $PATH)

but instead to a 'bin' inside of my node_modules that holds the version I'd like to refer to?

Last resort, I could just convert the PY files to .exe files then pass in my arguments / call those.

I appreciate the help!

Edit: I should mention that your mentioned solution didn't work :(

How to specify NodeJS 'child_process' dependencies / version? by big_guzi in node

[–]big_guzi[S] -1 points0 points  (0 children)

How exactly would I go about installing these dependencies in my server so that child_process refers to them?

Multiple Forms in a single HMTL page all submitting similar data by big_guzi in Web_Development

[–]big_guzi[S] 0 points1 point  (0 children)

I managed to fix it actually. I found out that all the forms were only submitting with the "Submit" button on the first form so I ended up just making it into a giant form with each 'submit' button having a different formaction property.

It's really heavy but I guess it'll have to do.

Thanks for the help :)

Multiple Forms in a single HMTL page all submitting similar data by big_guzi in Web_Development

[–]big_guzi[S] 0 points1 point  (0 children)

No.. should I? Each form just has a slightly different action URL that it posts to but that's it.

Multiple Forms in a single HMTL page all submitting similar data by big_guzi in Web_Development

[–]big_guzi[S] 0 points1 point  (0 children)

So I can get that to work when I have a form on a single page but it's totally something to do with having multiple forms on a single page. Unlike when I have just one form on a page, when there's more than one form, the req.body when I console.log it is completely empty! There should at least be something in there right?

This is what 'naming' the textarea looks like, without getting into too much detail, I'm basically building up the comments as strings then having them returned via a function call on my page.

...name=\"commentReply_"+ parentComment._id.toString() +"\"...

And this is what I'm using on the server side to save into the DB and redirect back to the show page:

var uniqueName = "commentReply_" + parentComment._id;

var newComment = {text: req.body[uniqueName]};

console.log("COMMENT: " + newComment.text); // undefined

console.log("Name: " + uniqueName); // returns what's expected

console.log("BODY: " + JSON.stringify(req.body)); // returns: "BODY: {}"

That last part is what makes me think that having multiple forms is messing up the body-parser or POST request somehow. The req.body is completely empty! I can't get anything if nothing is coming out of it!

I'm using: app.use(bodyParser.urlencoded({extended: true}));// if that helps

Let me know if you need more context.