简体   繁体   中英

appcfg.py command not found

I am following the How to set up AppEngineBackend Tutorial on this website https://cloud.google.com/resources/articles/how-to-build-mobile-app-with-app-engine-backend-tutorial

My current environment is:

1.Windows 8(64-bit).

2.Java 7

3.Eclipse 4.2 with ADT(Its the eclipse that is preconfigured with ADT downloaded from the Android Website)

I have had many problems relating to Java, invalid AppEngine SDK, etc. ever since I have started this tutorial. I resolved many of them and have come to the point where data needs to be uploaded to AppEngine datastore from a .csv file using a script in an upload_data.sh file using the following command :

./upload_data.sh places.csv Place

The contents of upload_data.sh are:

!/bin/sh

appcfg.py upload_data

--config_file bulkloader.yaml --url="http://localhost:8888/remote_api" --filename $1 --kind=$2 -e nobody@nowhere.com

Now the problem is that Windows does not support the .sh files. Also the file contains commands such as appcfg.py, --config_file,etc. For running the .sh file I downloaded Cygwin. Then I installed Python33 and also set the PythonPath environment variable to c:\\python33. When I run the above command from Cygwin terminal I get the following:

./upload_data.sh: line 2: appcfg.py: command not found

./upload_data.sh: line 3: --config_file: command not found

./upload_data.sh: line 4: nobody@nowhere.com: command not found

Do I need to tell Cygwin about my python location ? If yes then how to do it?

Also I installed Python and Cygwin much later after I installed Google AppEngine SDK.Is this causing the problem?Are Cygwin and Python supposed to be installed before AppEngine SDK?Does installation of AppEngine SDK automatically inform Cygwin about appcfg.py,etc.?

Although it's not listed as a prerequisite, installing the Google App Engine SDK for Python (available at Google's App Engine SDK Download page ) makes appcfg.py available to the command line.

During the installation of this SDK on a Mac, the installation puts appcfg.py on the PATH, thereby solving the "appcfg.py: command not found" error message. This may be similar for Windows.

Additionally, remove the line breaks (ie, the "Next line" space) that occurs before the --config_file and nobody@nowhere.com words - the script only needs to be a single continuous line without any line breaks (the line should only overflow to the next line due to reaching the edge of the editor).

Here is a simple work around.There's no need to create a shell or .bat file. This should work for anyone and for any operating system using the terminal or command prompt. Your local server should be running in debug mode or in other words you can successfully navigate to http://localhost:8888/_ah/admin

  1. Make sure you have downloaded and extracted Google App Engine SDK for Python to any location on your computer because the appcfg.py file is located in the parent directory extracted.

  2. Put the following files "bulkloader.yaml and places.csv" in the parent folder extracted in step1 ie in the same directory where the appcfg.py file is located.

  3. Run the following command directly in the terminal or command prompt:

    python appcfg.py upload_data --config_file bulkloader.yaml --url=http://localhost:8888/remote_api --filename places.csv --kind=Place -e nobody@nowhere.com

  4. Press enter when password prompt appears.. Enjoy!!!. Also you might need to wait for about a minute or two sometimes to confirm if the data is available from the datastore viewer.

The simplest solution (in my mind) to your question is to create a .bat file with following content:

python appcfg.py upload_data --config_file bulkloader.yaml --url="http://localhost:8888/remote_api" --filename $1 --kind=$2 -e nobody@nowhere.com

I haven't tested it so it might not work. Don't have a windows machine now. You'll need to put the folder of python.exe in your PATH environment variable.

Please use python 2.7 instead of python 3.3. I'm pretty sure Google App Engine doesn't support any Python 3.x yet.

Cheers

I also got this error on my Mac. It seems the newest version of Google App Engine not include appcfg.py in $PATH by default. The directory includes appcfg.py on my mac is $HOME/google-cloud-sdk/platform/google_appengine/ , you can just add this directory in your $PATH and it should work.

如果您搜索此修复程序的原因是在 appengine 部署中出错,因为它指出另一个部署正在进行中并且您的应用程序是使用 maven 构建的,那么更简单的回滚方法是将您的终端指向您运行的目录appengine 部署,然后输入$appengine:rollback

I know the question is far from the past, but pay attention that appcfg.py is deprecated

Now you should use gcloud commands - https://cloud.google.com/appengine/docs/standard/java/tools/migrating-from-appcfg-to-gcloud

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM