LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-17-2024, 06:46 PM   #1
Uxhamby
LQ Newbie
 
Registered: Jan 2015
Posts: 19

Rep: Reputation: Disabled
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.
 
Old 03-17-2024, 07:00 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by Uxhamby View Post
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).
 
Old 03-17-2024, 07:13 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,704

Rep: Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897
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

Last edited by michaelk; 03-17-2024 at 07:37 PM.
 
Old 03-18-2024, 04:39 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,852

Rep: Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310Reputation: 7310
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
 
Old 03-18-2024, 07:02 PM   #5
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
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."

Last edited by sundialsvcs; 03-18-2024 at 07:04 PM.
 
Old 03-19-2024, 07:59 AM   #6
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,781

Rep: Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082
Quote:
Originally Posted by Uxhamby View Post
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.
 
1 members found this post helpful.
Old 03-19-2024, 03:48 PM   #7
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,226

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Yep, complete nonsense. Probably AI-generated.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Apache 2.2.0: Should I Stay or Should I Go? LXer Syndicated Linux News 0 12-15-2005 07:16 PM
SuSE 9.3 - How should I get it? And should I? eBopBob SUSE / openSUSE 2 05-22-2005 03:36 AM
Boldly going where no newbie should go ... Should I get BSD? Mr. Hill Linux - Newbie 4 02-15-2005 05:27 AM
New FAQ topic: Should I edit my kernel configuration?/Should I build a custom kernel? chort *BSD 10 09-10-2004 11:15 PM
Should I stay, or should I go? /home/kyle General 23 03-14-2004 01:36 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration