LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   should this work? (https://www.linuxquestions.org/questions/programming-9/should-this-work-4175735011/)

Uxhamby 03-17-2024 06:46 PM

should this work?
 
Hi,

Is there anything obviously wrong with the process described here?

I have carefully recreated all the steps but have not had any success. Is it me?

Thanks,

Brian H.
Uxbridge Ont.

TB0ne 03-17-2024 07:00 PM

Quote:

Originally Posted by Uxhamby (Post 6490290)
Hi,
Is there anything obviously wrong with the process described here? I have carefully recreated all the steps but have not had any success. Is it me?

No idea, since you tell us nothing about your setup, what you've done to try to troubleshoot things, any relevant errors/messages you've seen, what kind of system, what's in that python script, etc. Running a python program from HTML is no different than running any other program from HTML; that procedure doesn't look at all complicated.

With no information, we cannot guess as to what could be your problem. Short answer to your question: no, nothing obviously wrong (other than the fact you're trying to DO that at all, which is incredibly insecure).

michaelk 03-17-2024 07:13 PM

That tutorial left out a few details.

What distribution and version are you running?

Any recent version is using python version 3 which the interpreter is called python3. Whether the web server environment includes /usr/bin or has access to the location where the python script exists depends on the distribution.

Code:

subprocess.run(["/usr/bin/python3", pythonScriptPath]);
Make sure your python script runs as expected.
Code:

python3 /path_to/python_script

pan64 03-18-2024 04:39 AM

That is not the right approach. I mean you do not need to ask us to review that page, but what you have made. So please give us more details about those steps.
Exactly what did you try, what's happened ...
http://www.catb.org/~esr/faqs/smart-...html#beprecise

sundialsvcs 03-18-2024 07:02 PM

Let's clarify:

The Python [u]subprocess[/b] system does, indeed, allow you to "fork" child processes within a single computer environment, and conveniently do things like "collect their results."

However, the quoted article is "mightily misleading(!)" when it goes on to say this:

Quote:

You can also use a Python web framework, such as Flask or Django, to run Python scripts from HTML buttons. Web frameworks provide a number of features that make it easier to develop web applications, such as routing, templating, and sessions.
Because it clearly shows that this person who describes himself thusly: (emphasis mine)

Quote:

Student of Computer Application and Network Administration || Cloud Technology and Cyber Security Enthusiast
... is very-clearly still a "student." He does not (yet) know the difference.

It is one thing to "conveniently execute subcommands on your own computer." (Which subprocess is specifically designed to do.) But, entirely a different thing to "execute a remote procedure call" (by whatever means ...) to execute them on another.

Of course, since you have not yet entirely described your scenario in your original post, all of what I am saying is "just a guess."

ntubski 03-19-2024 07:59 AM

Quote:

Originally Posted by Uxhamby (Post 6490290)
Is there anything obviously wrong with the process described here?

Yes, it's complete nonsense. You can't run local subprocesses from an HTML page.

dugan 03-19-2024 03:48 PM

Yep, complete nonsense. Probably AI-generated.


All times are GMT -5. The time now is 03:06 PM.