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.
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.