Python Forum
"Automate the Boring Stuff" Appendix B missing LOTS of information. Help?
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"Automate the Boring Stuff" Appendix B missing LOTS of information. Help?
#1
I've been going through "Automate the Boring Stuff with Python" and the actual Python material is great. But the Appendix B (about getting programs to run in the command line) is largely incomplete and quite poorly written in my opinion. With huge gaps in the text, I naturally have a few questions. 

1). From the text: "to make it convenient to run your Python program, create a .bat batch file for running the Python program with py.exe. To make a batch file, make a new text file..."
Q: It's unclear from the text whether one should make a batch file for every single python program that you make, or if one batch file will be used for ALL python programs you will make in the future. The text is singular ("A batch file"), implying one batch file for all, but I'm guessing this is wrong?

2). From the text: "...make a new text file containing a single line like the following: @py.exe C:\path\to\your\pythonScript.py %*
Q: So, if I need to make a batch file for each python program I write, I'm guessing the name of the program would replace pythonScript.py?  I'm guessing that's what is meant, but the text is wildly vague.

3). From the text: "Now you can run any Python script in the C:\MyPytonScripts folder by simply pressing WIN-R and entering the script's name"
Q: An example here would be insanely helpful. As it reads, I'm unsure if I need a .py at the end, or just the name, or what. The literal text seems to say I push the Windows key with R, and then type just the program name - tictactoe for example. But again, I'm guessing this is wrong and the text is assuming things it doesn't say.

Regardless, I've created the batch file with the name of my program - tictactoe.py - replacing pythonScript.py in the batch file text.
I type in the WIN-R and put tictactoe.py, and absolutely nothing happens.
I have a shebang line, and I've edited my path environment variable in Windows. But it still doesn't work.

Is this book assuming several years of computer science, or am I crazy? The rest of the book seems fine, but holy cow is Appendix B a mess.
I REALLY appreciate any help anyone can offer.
Reply
#2
There is a tutorial on executing python code on the forum
Reply
#3
1. & 2. There is no need, just use python myprogram.py (from directory where script is located)
3. what do you use when you want to run on Linux or OS-X very short sighted.

Nothing happens because in order to see the batch file, it must be visible from the path

I don't know this book, already I don't like it

If you really need a way to execute it directly, look at the installer programs available here: https://pypi.python.org/pypi
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Run the code for some stuff it does not return me why Anldra12 3 2,844 Apr-19-2021, 02:01 PM
Last Post: Anldra12
  "Automate the Boring Stuff with Python" creating a path works but only for CMD promt Milos 2 2,864 Nov-28-2020, 01:08 PM
Last Post: Larz60+
  Unable to print stuff from while loop Nick1507 4 2,326 Sep-17-2020, 02:26 PM
Last Post: Nick1507
  How Do I Install Stuff for Python? CopBlaster 6 3,179 May-08-2020, 12:27 PM
Last Post: hussainmujtaba
  Learning to have Class and doing stuff with it... bako 2 1,989 Apr-29-2020, 05:07 PM
Last Post: bako
  Getting Cells from the Sheets "automate the boring stuff" Shafla 8 3,986 Sep-24-2019, 04:53 AM
Last Post: snippsat
  [split] Automate the boring stuff, inserting commas in list srikanth 1 2,106 Jul-02-2019, 02:29 PM
Last Post: metulburr
  Regex Issue from Automate the Boring Stuff book robgraves 2 2,814 Jun-16-2019, 12:41 AM
Last Post: robgraves
  Automate the boring stuff: regex not matching DJ_Qu 7 3,773 Apr-27-2019, 07:03 AM
Last Post: micseydel
  Automate the boring stuff : the tic tac toe game DJ_Qu 7 6,647 Apr-24-2019, 12:22 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

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