Tuesday, July 16, 2013

Google Glass Development For Windows - Beginner Tips

As an update to my last post, I am happy tonight because I have finally had success in getting the the Glass Quickstart for Python running on my instance of the Google App Engine for Windows 7. If you have read my previous post you know I was not doing well. My plea netting several kind messages that gave me hints at what I might be doing wrong, but I thought I'd start over, armed with new knowledge from failure and the kindness of the community.

Yay! The Glass Quickstart is finally running!

After much reading, I confirmed that the Python path was best for me and what I really needed to do is to have my environment setup correctly and carefully follow the steps outlined on the quickstart pages. So, I began fresh and took my time. Here is what I learned about setting up the development environment for Glass with Python and Google App Engine on Windows.

Install Python 2.7.x (not 3.x) before GAE. If you do this, GAE will know Python is there and set itself up to use it.

You have to install and then configure, so the best resource (at the time of this writing) to install Python on Windows 7 is this video from Michael Herman.

Do not use the 64 bit install, even if your machine is 64 bit. Some Python modules do not install or work correctly on Win64. Use the file on this page that is called:"Python 2.7.5 Windows Installer (Windows binary -- does not include source)" for best results.

To make Python easier to use from any location on your system, you have to set your PATH. Use this string in Windows PowerShell to set your PATH, which has all of the directories in it. The instructions at Google or Python.org or python-guide.org are OK, but this PATH from the video from Michael Herman is the best: [Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27\;C:\Python27\Scripts\;C:\PYTHON27\DLLs;C:\PYTHON27\LIB;", "User")

After you have tested Python by itself, then follow these instructions from Google to install the GAE.

In that set of instructions, there is a step-by-step tutorial which, if you are careful, will get you a running application called 'Guestbook'. It was helpful to do this before the Glass Quickstart to ensure my environment was working fine.

As Google recommends, to edit the example files and your own code, install and the free text editor Notepad++ (not the Notepad app that comes with Windows). I had issues with incorrectly encoded characters from the cut&paste code using plain old Notepad.

After that is all installed, I went through the Python Tutorial for GAE and built the app. Here is my running example.

Because the Glass Quickstart code is downloaded from the code versioning website, GitHub, I signed up for and installed GitHub for Windows. I can see how it will be useful but it is not needed to just get the Quickstart up and running. You could just download the ZIP file and extract it.

While working with the GAE, make use of the Google App Engine Launcher. Yes, yes, I know you can type command lines, but for we who like a GUI this tool is helpful in getting your environment and application code running on local and then deployed on your instance of GAE.

My main advice: pay close attention to setting up Python and your development tools properly, use the installers and GUIs, and you will be successful.