Python Forum
Is possible to run the python command to call python script on linux?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is possible to run the python command to call python script on linux?
#2
This little Python:

#! /usr/bin/python3
#This program says hello and asks for your name.
print('This is Python speaking: Hello World')
print('What is your name?') #Ask for their name.
myName = input()
print('It is good to meet you,' + myName)
can run in bash by creating a bash script like this:

Quote:echo "This is bash speaking, I am now starting hello_world.py"
myPython/helloWorld.py

Make sure the script and the bash script are executable. I have the path for my bash scripts in my $PATH, /home/pedro/myBashscripts, so bash always finds them.

Don't forget the shebang: /usr/bin/python3 or bash and the computer go very weird!
Reply


Messages In This Thread
RE: Is possible to run the python command to call python script on linux? - by Pedroski55 - Jan-23-2024, 09:19 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Music Python Script Repeating Number When Saving Facebook Photos ThuanyPK 2 174 May-13-2024, 10:59 PM
Last Post: ebn852_pan
  Trying to generating multiple json files using python script dzgn989 4 270 May-10-2024, 03:09 PM
Last Post: deanhystad
  Problems passing arguments containing spaces to bash script and then on to python kaustin 6 541 Apr-03-2024, 08:26 PM
Last Post: deanhystad
  ChromeDriver breaking Python script genericusername12414 1 386 Mar-14-2024, 09:39 AM
Last Post: snippsat
  using PowerShell from Python script for mounting shares tester_V 8 661 Mar-12-2024, 06:26 PM
Last Post: tester_V
  No Internet connection when running a Python script basil_555 8 815 Mar-11-2024, 11:02 AM
Last Post: snippsat
Question Running Python script through Task Scheduler? Winfried 8 727 Mar-10-2024, 07:24 PM
Last Post: Winfried
  python script is hanging while calling a procedure in database prasanthi417 4 628 Jan-17-2024, 02:33 PM
Last Post: deanhystad
  run part of a script with a different version of Python jdog 2 503 Jan-09-2024, 08:49 PM
Last Post: jdog
  How to check if Skype call is connected or disconnected in Python? boral 1 454 Dec-28-2023, 08:31 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020