How to run these scripts…

If you are new to python, you may be asking how to run these scripts on the raspberry pi.  Astrotutor answered the same question over on the forums as follows:

Save the file in the same folder as the file, that is mcpi/api/python/mcpi.
Then open the game from the LXTerminal by typing
cd mcpi (enter)
Then from another opened LXTerminal (this is how I do it) type
cd mcpi/api/python (Enter)

One note — all the scripts here assume there is a “mcpi” subdirectory in the same directory as the script — and the mcpi contains all of the python scripts used to interact with minecraft.  These are all up on the github as well!

Hope this helps

Edit: Thanks for the comments, in whatever directory you are running the scripts — you must have a subdirectory named mcpi.  e.g.

run “python” and it should run fine…


10 thoughts on “How to run these scripts…

    • my bad i did a git clone and it put all his files into mcpipy under python did a mv and put all the scripts directly into the python folder and all is well some bug out but all in all my kids are grinning from ear to ear. Thank you all.

  1. No!!! It’s all wrong! The directory structure is `minecraft/api/python/mcpi/.` All the scripts I’ve seen posted here expect to be placed inside the `python` folder, not the `mcpi` folder. (That’s why they say `import mcpi.minecraft as minecraft`; It means “look inside the mcpi folder for a file called minecraft, and import that as ‘minecraft'”. The script should be placed in the same folder the mcpi folder, NOT in the mcpi folder itself.)

    In other words, the quote from the forum is wrong, but the note at the end of the post is correct.

  2. I just I stalled latest Wheezy and Minecraft Pi. Have example code in ~/mcpi/api/python (mcpi/ exists in that die, of course) but still getting code errors.

    Also, what does “mpi/…” mean at the end of r post? Wondering what I’m missing.

    • Hey blake, sorry that wasn’t clear.

      What I meant by the “mcpi/…” is you should have a number of files in that directory.

      Sorry this has been confusing, I’ll work on a new post to go through the setup step by step

  3. Awesome website guys, thanks for the info.
    I have a similar one I just started at:
    If we could build up a community that would be great! Thanks if you read this, and btw I followed this blog.


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s