Python path for the Google App Engine application pool

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 the path to the python executable:

enter image description here


Which way should I put in and what's the difference:

  • C: \ python27 \ python.exe
  • C: \ python27 \ pythonw.exe
+5
source share
5 answers

It appears that the Google App Engine could not find your python installation. It searches for Python by checking the PATH environment variable, so it is best to use it.

The short answer is using C:\Python27\pythonw.exe . I just installed the latest version of “GoogleAppEngine-1.9.33.msi”, and after starting “launch Google App Engine” ( C:\Program Files (x86)\Google\google_appengine\launcher\GoogleAppEngineLauncher.exe ) in "Edit → Settings "saw" C:\Python35\pythonw.exe ". (This is because I have a Python 3.5 folder in front of the Python 2.7 folder in my setup of the PATH environment variable.) But the fact is that the App Engine launcher (or installer) itself chose pythonw.exe over python.exe .

enter image description here

But as a better solution, I would suggest you set the PATH environment variable, this will prevent other similar problems in the future.

To install Python on PATH if it is not installed:

  • Right-click "Computer" (or "My Computer") and select "System Properties";
  • Go to the "Advanced" tab;
  • Click the "Environment Variables" button
  • Double-click the Path variable in the bottom list of system variables;
  • In the window that opens, in the "Values" add C:\Python27\;C:\Python27\Scripts; to the beginning of the line. Make sure you don’t accidentally delete anything there!
  • Click "OK" in this window and "OK" in the "Environment Variables" window, and you will go well.

Alternatively, in step 5, you can use the PATH user from the top list. I would install Python for all users as I described.

Now start the Google App Engine using the "Google App Engine Launcher" and see if the "Edit → Preferences" has the value "Default if not installed: C: \ Python27 \ pythonw.exe" or "Default if not installed : C: \ Python27 \ python.exe ", written under the field" Python Path ". If still nothing like this, then this is not a launcher that checks PATH , but it is an installer. Then it's time to uninstall "Google App Engine" and install it again. After that, everything should work as expected. (Btw, Installer checks Python and other dependencies, so it should report if there are any errors.)

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

  • python.exe opens a console widow when a module is executed with it, or, if executed directly from the command line, the module is executed in the current console window, preventing further commands until the module exits. This is mainly intended for console applications or debugging.
  • pythonw.exe , on the other hand, is designed for applications with a graphical interface or without a GUI application, therefore, if the module is executed with pythonw.exe , then there is no console window open, if it is executed through the current console, the module is executed in a separate process, and the console is accessible for further immediately. There is no flaw in this. case i.e. there are no errors printed because there are no console windows connected to the running Python module.

See below for more details: white papers , book chapter (small but informative) , Python mailing list .

Now, regarding the Google App Engine, the page says:

You will need Python 2.7 to use the App Engine SDK, as the Development Server is a Python application. Download Python 2.7.X (do not use a higher version) from the Python website.

So, since the server is a non-graphical application, this may be why App Engine chooses pythonw.exe .

+4
source

According to this QA, pythonw seems to be preferred: https://code.google.com/p/googleappengine/issues/detail?id=11246

Here's a similar question and answer: pythonw.exe or python.exe?

python.exe is a console application for running scripts of the CLI type.

pythonw.exe is a graphical application to run GUI scripts / no-UI-at-all.

+2
source

From a look at the docs: https://docs.python.org/2/using/windows.html#executing-scripts

Python basically suppresses the console window. I would not have thought that you need to use an application engine, so pythonw.exe would be my best guess.

+2
source

The error message says python=None . Check if you can run from cmd python -V to confirm that your python build is available throughout the system. GAE can usually automatically find your python installation and confirm your Python path before installation.

Try this tutorial if this helps.

0
source

Pythonw.exe is an executable file that does not open the console. Python.exe will open the console. You probably want to use pythonw.exe in this instance, because I don't know why you want to open the terminal for the application engine.

https://docs.python.org/2/using/windows.html

App Engine SDK also did not find your python installation. This is probably because you do not have a global env. declared variable.

0
source

Source: https://habr.com/ru/post/1243822/


All Articles