Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 [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.?

like image 916
user2231256 Avatar asked Oct 22 '13 15:10

user2231256


2 Answers

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).

like image 94
Tielman Nieuwoudt Avatar answered Oct 27 '22 00:10

Tielman Nieuwoudt


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.

like image 21
user3144836 Avatar answered Oct 27 '22 01:10

user3144836