unexpected error on gae when test on local machine - google-app-engine

I am really new on gae, but I have a task that have to deploy on google.
because I don't know how to stop after sudo /usr/local/bin/dev_appserver.py, I just press control+c. after a while, when I tried to deploy again, I receive following message:
INFO 2016-04-03 00:42:40,222 sdk_update_checker.py:229] Checking for updates to the SDK.
INFO 2016-04-03 00:42:41,272 api_server.py:205] Starting API server at: http://localhost:51277
INFO 2016-04-03 00:42:41,275 api_server.py:648] Applying all pending transactions and saving the datastore
INFO 2016-04-03 00:42:41,275 api_server.py:651] Saving search indexes
Traceback (most recent call last):
File "/usr/local/bin/dev_appserver.py", line 83, in <module>
_run_file(__file__, globals())
File "/usr/local/bin/dev_appserver.py", line 79, in _run_file
execfile(_PATHS.script_file(script_name), globals_)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 1040, in <module>
main()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 1033, in main
dev_server.start(options)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 824, in start
self._dispatcher.start(options.api_host, apis.port, request_data)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/dispatcher.py", line 194, in start
_module.start()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/module.py", line 1176, in start
self._balanced_module.start()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/wsgi_server.py", line 315, in start
self._start_all_fixed_port(host_ports)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/wsgi_server.py", line 352, in _start_all_fixed_port
raise BindError('Unable to bind %s:%s' % self.bind_addr)
google.appengine.tools.devappserver2.wsgi_server.BindError: Unable to bind localhost:8080
so far, I tried reinstall gaelauncher, but it doesn't work.
please, any help would be good.

After a few days, it worked again. I think it is Google App Engine's thing and I don't know its reason so far. But if you just want to use the deploy-on-localhost function, please step to other tools, it will be easier. Suggestion: MAMP.

Related

Running Local Version of Schema.org

I am attempting to run a local version of the schema.org app so I can write a proposal for an addition to the ontology. I followed the tutorial at http://dataliberate.com/2016/02/10/evolving-schema-org-in-practice-pt1-the-bits-and-pieces/, which had me set up Google App Engine and download a forked version of schema.org using Git.
Unfortunately, I cannot get the schema.org app to run on my machine. Sample GAE apps work fine, but whenever I start the schema.org app I get the following error:
Traceback (most recent call last):
File "C:\Users\Kevin\Desktop\Ontology\schemaorg\lib\rdflib\plugins\parsers\pyRdfa\__init__.py", line 580, in graph_from_source
if not rdfOutput : raise f
rdflib.plugins.parsers.pyRdfa.FailedSource
ERROR2016-09-29 14:54:39,825 wsgi.py:263]
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "C:\Users\Kevin\Desktop\Ontology\schemaorg\sdoapp.py", line 2585, in <module>
read_schemas(loadExtensions=ENABLE_HOSTED_EXTENSIONS)
File "C:\Users\Kevin\Desktop\Ontology\schemaorg\api.py", line 1055, in read_schemas
apirdflib.load_graph('core',file_paths)
File "C:\Users\Kevin\Desktop\Ontology\schemaorg\apirdflib.py", line 118, in load_graph
g.parse(file=open(full_path(f),"r"),format=format)
File "C:\Users\Kevin\Desktop\Ontology\schemaorg\lib\rdflib\graph.py", line 1037, in parse
parser.parse(source, self, **args)
File "C:\Users\Kevin\Desktop\Ontology\schemaorg\lib\rdflib\plugins\parsers\structureddata.py", line 145, in parse
check_lite=check_lite
File "C:\Users\Kevin\Desktop\Ontology\schemaorg\lib\rdflib\plugins\parsers\structureddata.py", line 176, in _process
processor.graph_from_source(orig_source, graph=graph, pgraph=processor_graph, rdfOutput=False)
File "C:\Users\Kevin\Desktop\Ontology\schemaorg\lib\rdflib\plugins\parsers\pyRdfa\__init__.py", line 662, in graph_from_source
if not rdfOutput : raise b
FailedSource
INFO 2016-09-29 10:54:39,951 module.py:788] default: "GET /_ah/warmup HTTP/1.1" 500-
The problem is occurring when it tries to parse the RDF, but I suspect the lack of RDF output is being caused by the 500 error. I have done an extensive search and found plenty of examples of the 500 error with GAE, but none of the suggested fixes has worked (e.g., increasing the TIMEOUT setting, rolling back to SDK 1.36).
I am running the app on localhost:9080. I get a 500 error whenever I try to access it from the browser. I can, however, access the admin at localhost:8001. For some reason, it shows two instances running.
Any help would be greatly appreciated. Let me know if you need more information.
This problem has now been fixed with a Windows specific patch to the Schema.org code line as referenced in Git Issues (#1384) and (#1412)
A pull of the latest code from the repository should clear the problem.

How do I run all tests in a directory without crashes?

When I do goapp test ./.. in my app directory, I get spurious failures from the dev_appserver.py script. Example:
INFO 2014-06-14 15:09:43,457 devappserver2.py:706] Skipping SDK update check.
WARNING 2014-06-14 15:09:43,457 devappserver2.py:722] DEFAULT_VERSION_HOSTNAME will not be set correctly with --port=0
Traceback (most recent call last):
File "/home/travis/go_appengine/dev_appserver.py", line 82, in <module>
_run_file(__file__, globals())
File "/home/travis/go_appengine/dev_appserver.py", line 78, in _run_file
execfile(_PATHS.script_file(script_name), globals_)
File "/home/travis/go_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 943, in <module>
main()
File "/home/travis/go_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 936, in main
dev_server.start(options)
File "/home/travis/go_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 749, in start
request_data, storage_path, options, configuration)
File "/home/travis/go_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 848, in _create_api_server
default_gcs_bucket_name=options.default_gcs_bucket_name)
File "/home/travis/go_appengine/google/appengine/tools/devappserver2/api_server.py", line 359, in setup_stubs
auto_id_policy=datastore_auto_id_policy)
File "/home/travis/go_appengine/google/appengine/datastore/datastore_sqlite_stub.py", line 629, in __init__
(self.__datastore_file, e))
google.appengine.runtime.apiproxy_errors.ApplicationError: ApplicationError: 3 Data in /tmp/appengine.testapp.travis/datastore.db is corrupt or a different version. Try running with the --clear_datastore flag.
OperationalError('database schema has changed',)
Note that even though this particular example is runing on Travis CI; I do get the same failures when running locally.
If I run individual tests one at a time, they all pass just fine.

Combine large files in Blobstore GAE FileNotOpenedError: ApplicationError: 10

I'm trying merge 2 files and to create one new in the BlobStore of the AppEngine. This files are 12.000 rows and have 12 MB. The problem occurs when i writte the new file, because in middle of write appear the next error:
ApplicationError: 10
Traceback (most recent call last):
File "/base/data/home/runtimes/python/python_lib/versions/1/google/appengine/ext/webapp/_webapp25.py", line 716, in __call__
handler.post(*groups)
File "/base/data/home/apps/s~ono-hat-vv2/1.369681903434492066/com/__init__.py", line 244, in post
self.principal(cont+1, numFicheritos,"csvTotal","uniendoCSV")
File "/base/data/home/apps/s~ono-hat-vv2/1.369681903434492066/com/__init__.py", line 277, in principal
self.escribirtxt(f, cadenaSalida)
File "/base/data/home/apps/s~ono-hat-vv2/1.369681903434492066/com/__init__.py", line 308, in escribirtxt
f.write(linea)
File "/base/data/home/runtimes/python/python_lib/versions/1/google/appengine/api/files/file.py", line 326, in write
self._make_rpc_call_with_retry('Append', request, response)
File "/base/data/home/runtimes/python/python_lib/versions/1/google/appengine/api/files/file.py", line 427, in _make_rpc_call_with_retry
_make_call(method, request, response)
File "/base/data/home/runtimes/python/python_lib/versions/1/google/appengine/api/files/file.py", line 252, in _make_call
_raise_app_error(e)
File "/base/data/home/runtimes/python/python_lib/versions/1/google/appengine/api/files/file.py", line 195, in _raise_app_error
raise FileNotOpenedError(e)
FileNotOpenedError: ApplicationError: 10
I have read that the problem is in the time that I open the file, because this can't be greater that 30 s. How can i resolve this problem and merge this file?
Close the file and re-open every so often.
Have you looked at Google Cloud Storage? It may not have this limitation and also the app engine files api has been deprecated and we need to move in that direction anyway. Something to consider.

GAE: raise ValueError('must be "yes" or "no", not %r' % values)

A popup on my desktop recently offered to update GoogleAppEngineLauncher, and I agreed to it.
My Python apps in PyCharm then showed "unrecognized reference" for "google" in from google.appengine.api import users or any other reference to "google.appengine.api".
So I launched GoogleAppEngineLauncher and clicked something, and it looked like it did an unzip or something. That made the PyCharm reference errors go away.
When I then tried to launch my app with my old configuration, it had a problem with "Additional options". Apparently it no longer recognizes "-p 8081" or "-c". So I changed them to "--port 8081" and "--clear_datastore". Now it terminates with the following stacktrace:
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/dev_appserver.py", line 194, in <module>
_run_file(__file__, globals())
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/dev_appserver.py", line 190, in _run_file
execfile(script_path, globals_)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 545, in <module>
main()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 535, in main
options = PARSER.parse_args()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1688, in parse_args
args, argv = self.parse_known_args(args, namespace)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1720, in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1926, in _parse_known_args
start_index = consume_optional(start_index)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1866, in consume_optional
take_action(action, args, option_string)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1794, in take_action
action(self, namespace, argument_values, option_string)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/boolean_action.py", line 67, in __call__
raise ValueError('must be "yes" or "no", not %r' % values)
ValueError: must be "yes" or "no", not '.'
I tried running "helloworld" in GoogleAppEngineLauncher and got the following in the LogConsole:
*** Running dev_appserver with the following flags:
--skip_sdk_update_check=yes --port=8081 --admin_port=8000 --clear_datastore
Python command: /usr/bin/python2.7
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/dev_appserver.py", line 194, in <module>
_run_file(__file__, globals())
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/dev_appserver.py", line 190, in _run_file
execfile(script_path, globals_)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 545, in <module>
main()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 535, in main
options = PARSER.parse_args()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1678, in parse_args
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1710, in parse_known_args
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1916, in _parse_known_args
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1856, in consume_optional
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1784, in take_action
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/boolean_action.py", line 67, in __call__
raise ValueError('must be "yes" or "no", not %r' % values)
ValueError: must be "yes" or "no", not '/Users/lindsay/Projects/PyCharm/Zephyr/gae-tutorial/helloworld'
This seems to be more or less the same error as from running my app in PyCharm.
I am under tremendous time pressure on this project, and this is completely blocking me. Any help will be most appreciated.
The solution to this problem was that configuration option -c has to be changed to --clear_datastore=yes.
Now I'm getting to another error, "InvalidCertificateException". I'll investigate that separately, and post a separate question if I can't solve it.

Mercurial Error - Can't Find File

I'm just getting started with Mercurial, downloaded and installed hg command-line for Windows, cloned a new BitBucket repository, added a file, but when I commit I get this error:
>hg commit -m 'first commit'
abort: commit': The system cannot find the file specified
The added file is definitely in the repository folder. When I run hg status I get:
A Ant.java
And adding --traceback to the commit message gets me:
Traceback (most recent call last):
File "mercurial\dispatch.pyc", line 87, in _runcatch
File "mercurial\dispatch.pyc", line 684, in _dispatch
File "mercurial\dispatch.pyc", line 466, in runcommand
File "mercurial\dispatch.pyc", line 738, in _runcommand
File "mercurial\dispatch.pyc", line 692, in checkargs
File "mercurial\dispatch.pyc", line 681, in <lambda>
File "mercurial\util.pyc", line 458, in check
File "mercurial\commands.pyc", line 1194, in commit
File "mercurial\cmdutil.pyc", line 1223, in commit
File "mercurial\commands.pyc", line 1189, in commitfunc
File "mercurial\localrepo.pyc", line 1036, in commit
File "mercurial\localrepo.pyc", line 1295, in status
File "mercurial\dirstate.pyc", line 685, in status
File "mercurial\dirstate.pyc", line 594, in walk
File "mercurial\localrepo.pyc", line 1016, in fail
Abort: commit': The system cannot find the file specified
abort: commit': The system cannot find the file specified
In googling the question, lots of references to TortoiseHG appeared. I did used to have that installed, but got rid of it and restarted, there doesn't seem to be anything left on the system. Any ideas as to what I could try, or any mistakes I might have made?
Use double quotes: hg commit -m "first commit"
Just to note you can get this error due to unwittingly having a space between the dash and the m i.e.
- m as opposed to -m.

Resources