Python as you probably know is an interesting programming language, unlike most others — whitespace is important. The level of spaces or tabs defines the structure of the program. As a result of this, copying and pasting python scripts across web pages can result in unintended changes in how the program runs (or doesn’t at all).
To resolve this problem and generally make it easier to retrieve the various scripts in a working state, I’ve started collecting all the scripts in a github repository.
If you don’t understand git don’t despair (I’m not an expert myself) – what this means is all the scripts are stored on an internet server and with a simple command you can download all of them or the recent updates.
- install Git. Here’s one guide covering Windows, Linux and Mac.
- open a terminal or command prompt.
- type “git clone https://github.com/brooksc/mcpipy.git”
- change into that directory. e.g. “cd mcpipy”
- Change to the same directory from above
- type “git fetch origin” to retrieve the changes
- type “git merge origin/master” to merge the changes in
- import statements are updated to use “import mcpi” and a copy of mcpi scripts are included in the repo
- I added a comment to each script to ensure proper author attribution by name and original URL where found
If it all worked correctly – you’ll now have in your directory all the scripts mentioned on this blog so far and ready to run!
Once you’ve done this — in the future you can just run a command to get all the latest updates. To do this
(if any git masters notice an error in the above, please leave me a comment!)
Hopefully this will make it easier to download the scripts mentioned here and ensure they work as expected!
Also a quick comment to script authors — I’ve made some minor changes as follows: