A better way to get the scripts…

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.

    1. install Git. Here’s one guide covering Windows, Linux and Mac.
    2. open a terminal or command prompt.
    3. type “git clone https://github.com/brooksc/mcpipy.git”
    4. change into that directory. e.g. “cd mcpipy”

    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

    1. Change to the same directory from above
    2. type “git fetch origin” to retrieve the changes
    3. type “git merge origin/master” to merge the changes in

    (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:

    1. import statements are updated to use “import mcpi” and a copy of mcpi scripts are included in the repo
    2. I added a comment to each script to ensure proper author attribution by name and original URL where found

    Happy scripting!

    Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s