appcfg.py not working in command line

后端 未结 3 1285
感情败类
感情败类 2020-11-29 12:57

I\'m just having a bit of trouble understanding why this command:

>appcfg.py -A adept-box-109804 update app.yaml

as given by the Try Goo

相关标签:
3条回答
  • 2020-11-29 13:13

    Your confusion probably stems from mixing up 2 possible invocations styles:

    1. python appcfg.py ...
    2. appcfg.py ...

    The 1st one can't make use of the fact that the location of the appcfg.py is in the path, it is just an argument to the python executable, which can not locate the appcfg.py file unless either:

    • it finds it in the current directory
    • the appcfg.py file is specified using a full path or a path relative to the current working directory from which python is invoked

    This is the reason for which your 2nd and 3rd commands don't work as you'd expect. Using the 2nd invocation style instead should work if the location of the appcfg.py is in the path - just as your last command invocation does.

    Key point to remember: the path configuration applies to the command executable only, not to its arguments (which BTW each executable may process as it wishes, some executables may combine arguments with the path configuration to obtain location of files).

    Similarly appcfg.py itself (once successfully invoked using either of the 2 invocation styles) needs to be able to locate your app.yaml file specified as argument. It cannot do so unless either:

    • it finds it in the current directory
    • the app.yaml file (or its directory) is specified using a full path or a path relative to the current working directory from which appcfg.py is invoked

    I suspect appcfg.py's inability to locate your app.yaml file may be the reason for which the 1st command you mentioned didn't work. If not you should provide details about the failure.

    Regarding why the output of your last command is identical regardless of the arguments, I'm not sure, it could be a bug in the windows version of the SDK. In linux the output is different:

    > appcfg.py help backends
    Usage: appcfg.py [options] backends <directory> <action>
    
    Perform a backend action.
    
    The 'backends' command will perform a backends action.
    
    Options:
      -h, --help            Show the help message and exit.
      -q, --quiet           Print errors only.
      -v, --verbose         Print info level logs.
      --noisy               Print all logs.
      -s SERVER, --server=SERVER
                            The App Engine server.
      -e EMAIL, --email=EMAIL
                            The username to use. Will prompt if omitted.
      -H HOST, --host=HOST  Overrides the Host header sent with all RPCs.
      --no_cookies          Do not save authentication cookies to local disk.
      --skip_sdk_update_check
                            Do not check for SDK updates.
      -A APP_ID, --application=APP_ID
                            Set the application, overriding the application value
                            from app.yaml file.
      -M MODULE, --module=MODULE
                            Set the module, overriding the module value from
                            app.yaml.
      -V VERSION, --version=VERSION
                            Set the (major) version, overriding the version value
                            from app.yaml file.
      -r RUNTIME, --runtime=RUNTIME
                            Override runtime from app.yaml file.
      -E NAME:VALUE, --env_variable=NAME:VALUE
                            Set an environment variable, potentially overriding an
                            env_variable value from app.yaml file (flag may be
                            repeated to set multiple variables).
      -R, --allow_any_runtime
                            Do not validate the runtime in app.yaml
      --oauth2              Ignored (OAuth2 is the default).
      --oauth2_refresh_token=OAUTH2_REFRESH_TOKEN
                            An existing OAuth2 refresh token to use. Will not
                            attempt interactive OAuth approval.
      --oauth2_access_token=OAUTH2_ACCESS_TOKEN
                            An existing OAuth2 access token to use. Will not
                            attempt interactive OAuth approval.
      --authenticate_service_account
                            Authenticate using the default service account for the
                            Google Compute Engine VM in which appcfg is being
                            called
      --noauth_local_webserver
                            Do not run a local web server to handle redirects
                            during OAuth authorization.
    
    0 讨论(0)
  • 2020-11-29 13:18

    I had this problem, and is deepened in local variable python version that different from app engine python version. So the solution is just to add before the script the current python version location:

    C:\Python27\python.exe "C:\Program Files (x86)\Google\google_appengine\appcfg.py"
    

    And it just return to work well.

    0 讨论(0)
  • 2020-11-29 13:21

    I finally tracked down the real reason, and it wasn't a bug with the AppEngine SDK. Rather it was with my Python interpreter, as I noticed it wasn't accepting arguments for any .py files. It turned out to be a registry error, located at [HKEY_CLASSES_ROOT\Applications\python.exe\shell\open\command] where I had to change the value from "C:\Python27\python.exe" "%1" to "C:\Python27\python.exe" "%1" %*

    How this happened, whether it be the Python 2.7 installer, or maybe the AppEngine SDK, I'm not sure though.

    0 讨论(0)
提交回复
热议问题