Unable to access external Google AppEngine application libraries.

Please help ... I am running some python code from cygwin and I cannot import the GoogleAppEngine (GAE) external data API. I think this may be the problem of environment variables. I can start GAE and "remote_data_api_shell.py" from the command line, but I can not start the python module that references GAE.

I work in trial and error mode, using every combination of strings of environment variables that I can think of. Nothing works, and my frustration is growing.

  • GAE (1.5) is located in (window path): C: \ Program Files (x86) \ Google \ google_appengine

  • Here is my Python error:

Traceback (last last call): File "/cygdrive/c/data/my-program/MyProgram.py", line 48, in '<' module '>'

from MyStoredObject model import File "/cygdrive/c/data/my-program/Model.py", line 6, to '<' module '>' from google.appengine.ext import db ImportError: There is no module named google.appengine .ext

  • I am setting my environment variables in a bashc cygwin file. My bashrc file contains

    GAE_HOME = "/ cygdrive / c / Program \ Files \ (x86) / Google / google_appengine"

    I tried many combinations of strings and characters here.

    PATH = "$ PATH: $ GAE_HOME

    PYTHONPATH = "$ PYTHONPATH: $ GAE_HOME: $ GAE_HOME / Library / YAML / Library:

    Also tried $GAE_HOME/google/appengine/ext and more ...

    export PYTHONPATH

    export PATH

    export GAE_HOME

How can I do this job? Anything obvious to the GAE expert that I'm doing wrong here?

+6
source share
2 answers

I have this at the top of the scripts that I run that should interact with the appengine SDK

 import sys import os # locate app-engine SDK AE_PATH = "/path/to/sdk/google_appengine/" # path to app code APP_PATH = os.path.abspath(".") # load the AE paths (as stolen from dev_appserver.py) EXTRA_PATHS = [ APP_PATH, AE_PATH, os.path.join(AE_PATH, 'lib', 'antlr3'), os.path.join(AE_PATH, 'lib', 'django'), os.path.join(AE_PATH, 'lib', 'ipaddr'), os.path.join(AE_PATH, 'lib', 'webob'), os.path.join(AE_PATH, 'lib', 'yaml', 'lib'), os.path.join(AE_PATH, 'lib', 'fancy_urllib'), # issue[1] ] sys.path = EXTRA_PATHS + sys.path 

[1] problem fancy_urllib

Hope you are in the right direction

+6
source

This should fix the ways:

 sdk_path = "/path/to/sdk/google_appengine/" sys.path.insert(0, sdk_path) import dev_appserver dev_appserver.fix_sys_path() 
+2
source

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


All Articles