Search code examples
pythongoogle-app-enginelaunchergoogle-app-engine-pythongoogle-app-engine-launch

Google App Engine Launcher Python Path


When I install the Google App Engine SDK and run the launcher, it asks me to configure the python location:

enter image description here


And when I open Preferences, it asks for a path to a python executable:

enter image description here


Which path should I insert and what is the difference:

  • C:\Python27\python.exe
  • C:\Python27\pythonw.exe

Solution

  • Looks like Google App Engine couldn't find your python installation. It looks for Python by checking the PATH environment variable, so it's best to use it.

    The short answer is use C:\Python27\pythonw.exe. I've just installed the latest "GoogleAppEngine-1.9.33.msi", and after I ran "Google App Engine launcher" (C:\Program Files (x86)\Google\google_appengine\launcher\GoogleAppEngineLauncher.exe), in "Edit -> Preferences" I saw "C:\Python35\pythonw.exe". (It is because I have Python 3.5 folder before Python 2.7 folder in my Path environment variable setting.) But the point is App Engine launcher (or installer) chose the pythonw.exe over python.exe all by itself.

    enter image description here

    But as a better solution, I would suggest you to set your Path environment variable, this will prevent other similar issues in the future.

    To set Python on the Path, if it's not set:

    1. Right click "Computer" (or "My Computer") and choose "System Properties";
    2. Switch to "Advanced" tab;
    3. Press "Environment variables" button;
    4. Double click "Path" variable in the lower list of system variables;
    5. In the opened window in "Values" add C:\Python27\;C:\Python27\Scripts; to the beginning of the line. Make sure you don't accidently delete anything there!
    6. Press "OK" in this window and "OK" in "Environment variables" window and you're good to go.

    Alternatively in item 5, you might want to use user's PATH from the upper list. I would set Python for all users as I described.

    Now launch Google App Engine via "Google App Engine Launcher" and see if in "Edit -> Preferences" you have either "Default if not set: C:\Python27\pythonw.exe" or "Default if not set: C:\Python27\python.exe" written below the field for "Python path". If there's still nothing similar, then it's not the launcher that checks for PATH, but it's the Installer. Then now it's time to uninstall "Google App Engine" and install it again. After this everything should work as expected. (Btw, Installer checks for Python and other dependecies, so it should report if there're any errors.)

    The main difference between python.exe and pythonw.exe is:

    • python.exe opens console widow when a module is executed with it, or, if run directly from command line, executes a module in a current console window preventing any further commands until the module exits. So basically intended for console applications or debugging.
    • pythonw.exe on the other hand is intended for GUI apps or no-GUI apps, so if a module is executed with pythonw.exe, then there's no console window is open, if run via current console a module is executed in a separate process and the console is available for further commands right away. The drawback is no output is provided in this case, i.e. no errors printed as there's no console window associated with running Python module.

    Fore details see: official docs, chapter from a book(small but informative), Python mailing list.

    Now regarding Google App Engine, on installation page they state:

    You will need Python 2.7 to use the App Engine SDK, because the Development Server is a Python application. Download Python 2.7.X (don't use a higher version) from the Python web site.

    So since a server is a no-GUI application, that's probably why App Engine chooses pythonw.exe.