9
votes

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 [email protected]

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: [email protected]: 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.?

6
Do you need any more help with this question?Tielman Nieuwoudt

6 Answers

6
votes

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 (i.e., the "Next line" space) that occurs before the --config_file and [email protected] 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).

4
votes

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 i.e. 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 [email protected]

  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.

1
votes

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 [email protected]

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

1
votes

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.

0
votes

If the reason you are searching for this fix is to error in appengine deployment since it states that another deploy is in progress and your app is built with maven, the easier way to rollback is to point your terminal to the directory from where you run the appengine deployments, and type $appengine:rollback.

0
votes

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