Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to Run a Python Script
#1
Hello,

I'm new to Python programming, so don't bash me pls :D.

I got an Ubuntu server and a Windows 8.1 PC, I found a python script from github but i have no idea how can i make it run. I'd be very happy if you could help me how to run it. Have a nice day.


https://github.com/calder/mafia/
Reply
#2
Change the directory to the path, where your Script is with cd. For example when your script is on desktop in the directory develop:

Open cmd
py Desktop\develop\your_script.py
# or
cd Desktop\develop\
py your_script.py
py is the new helper tool, which launches the Python interpreter without modifying the PATH environment variable.
More about this tool: https://docs.python.org/3/using/windows.html#launcher

You can also use the graphical editor IDLE to run your program. The shortcut is F5.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#3
(Jul-31-2017, 06:37 PM)DeaD_EyE Wrote: Change the directory to the path, where your Script is with cd. For example when your script is on desktop in the directory develop:

Open cmd
py Desktop\develop\your_script.py
# or
cd Desktop\develop\
py your_script.py
py is the new helper tool, which launches the Python interpreter without modifying the PATH environment variable.
More about this tool: https://docs.python.org/3/using/windows.html#launcher

You can also use the graphical editor IDLE to run your program. The shortcut is F5.


forgive my ignorance but there are more than one files which one of the files should i set as my script/file?
Reply
#4
(Jul-31-2017, 06:39 PM)umityayla Wrote: forgive my ignorance but there are more than one files which one of the files should i set as my script/file?


That's not a script, it's a module.  It doesn't make sense to run it directly.  As is described in that page's readme, the way to use it is to make a new file, import it, set the options you want, and to then run the file you made.
Reply
#5
(Jul-31-2017, 06:51 PM)nilamo Wrote:
(Jul-31-2017, 06:39 PM)umityayla Wrote: forgive my ignorance but there are more than one files which one of the files should i set as my script/file?


That's not a script, it's a module.  It doesn't make sense to run it directly.  As is described in that page's readme, the way to use it is to make a new file, import it, set the options you want, and to then run the file you made.

now, i got it thanks.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is there a *.bat DOS batch script to *.py Python Script converter? pstein 3 3,009 Jun-29-2023, 11:57 AM
Last Post: gologica
  How to kill a bash script running as root from a python script? jc_lafleur 4 5,793 Jun-26-2020, 10:50 PM
Last Post: jc_lafleur
  crontab on RHEL7 not calling python script wrapped in shell script benthomson 1 2,254 May-28-2020, 05:27 PM
Last Post: micseydel
  Package python script which has different libraries as a single executable or script tej7gandhi 1 2,583 May-11-2019, 08:12 PM
Last Post: keames
  How to run python script which has dependent python script in another folder? PrateekG 1 3,105 May-23-2018, 04:50 PM
Last Post: snippsat
  How to call one python script and use its output in another python script lravikumarvsp 3 32,288 May-16-2018, 02:08 AM
Last Post: lravikumarvsp
  Check Python version from inside script? Run Pythons script in v2 compatibility mode? pstein 2 9,790 Jul-07-2017, 08:59 AM
Last Post: snippsat
  Cant pass corect variables to python script in bash script neradp 3 6,136 Nov-05-2016, 01:26 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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