I'm writing a program that uses oauth2 library of google for some app in google-app-engine. When I run the server on my machine, it raises an IOError exception of this sort --
File "/home/deploy/Downloads/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 592, in __init__
raise IOError(errno.EACCES, 'file not accessible', filename)
IOError: [Errno 13] file not accessible: '/usr/local/lib/python2.7/dist-packages/oauth2client-1.0c2-py2.7.egg'
I have that egg file in the directory it named. I installed it from the google-api-python project page. What am I doing wrong? I also noticed that most of the egg files in the directory also have a ....egg-info file. oauth2client-1.0c2-py2.7.egg-info file in not present. Does that cause the error?
If i open my python interpreter and try to open the file, it succeeds in opening it...
You must copy the oauth2client directory into the root directory of your project folder. App Engine requires all used packages to be included.
Related
I recently upgraded my cloud SDK, and now I can no longer deploy to app engine flexible. I deploy my app with the following command:
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\gcloud.cmd preview app deploy --promote vm.yaml
I am getting get the following output and crash (abridged):
WARNING: Could not acquire lock C:\Users\Michael\AppData\Roaming\gcloud\credentials.lock in 0 seconds
WARNING: The credentials file (C:\Users\Michael\AppData\Roaming\gcloud\credentials) is not writable. Opening in read-only mode. Any refreshed credentials will only be valid for this run.
WARNING: Could not acquire lock C:\Users\Michael\AppData\Roaming\gcloud\credentials.lock in 0 seconds
WARNING: The credentials file (C:\Users\Michael\AppData\Roaming\gcloud\credentials) is not writable. Opening in read-only mode. Any refreshed credentials will only be valid for this run.
WARNING: Could not acquire lock C:\Users\Michael\AppData\Roaming\gcloud\credentials.lock in 0 seconds
WARNING: The credentials file (C:\Users\Michael\AppData\Roaming\gcloud\credentials) is not writable. Opening in read-only mode. Any refreshed credentials will only be valid for this run.
...
ERROR: gcloud crashed (OSError): [Errno 13] Permission denied: 'C:\\Users\\Michael\\AppData\\Roaming\\gcloud\\credentials.lock'
If you would like to report this issue, please run the following command:
gcloud feedback
Below is some of the output from gcloud feedback
Trace:
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\gcloud_main.py:171
gcloud_cli.Execute()
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\calliope\cli.py:719
result = args.calliope_command.Run(cli=s...
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\calliope\backend.py:1404
resources = command_instance.Run(args)
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\surface\app\deploy.py:91
return deploy_util.RunDeploy(self, args,...
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\command_lib\app\deploy_util.py:206
service, code_bucket_ref)
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\api_lib\app\deploy_app_command_util.py:233
_UploadFiles(files_to_upload, bucket_ref...
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\api_lib\app\deploy_app_command_util.py:175
results = pool.map(_UploadFile, tasks)
c:\Python27\lib\multiprocessing\pool.py:251
return self.map_async(func, iterable, ch...
c:\Python27\lib\multiprocessing\pool.py:567
raise self._value
OSError: [Errno 13] Permission denied: 'C:\\Users\\Michael\\AppData\\Roaming\\gcloud\\credentials.lock'
Installation information:
Google Cloud SDK [120.0.0]
Platform: [Windows, x86_64]
Python Version: [2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:32:19) [MSC v.1500 32 bit (Intel)]]
Python Location: [c:\Python27\python.exe]
[output truncated]
Any ideas?
This is a bug with the Google SDK's parallel upload feature introduced in June 2016. Work-around the bug by turning off the feature with the following command:
gcloud config set app/num_file_upload_processes 1
The command above limits the number of parallel uploads to 1 thread/process, so they don't step on each other's feet.
I recently had the same issue. Go to the directory shown in the error message. You'd find two credientials files. Delete the one with the LOCK extension( it would be the empty one). Then redeploy your project. Worked perfectly for me.
I've also ran into this issue as well. How it happened --> I ran gcloud app deploy command, but later realised that the deployment took much longer to finish (perhaps hanging), then I killed the batch process i.e. CTRL +C. When I reissued the command thats when I got into this issue. So the SOLUTION, do what's already said above i.e. go and delete the credentials.lock file (in my case it found in C:\Users\Sam\AppData\Roaming\gcloud directory)
The better way is to solve this error is to reinstall after deleting the root directory where lock file is.
I have followed all the steps on https://cloud.google.com/appengine/docs/go/#creating_a_simple_http_handler on how to get started with Go, but I am stuck on an issue while trying to run the helloworld app.
I get the following error:
C:\Users\kirill\Desktop\go_appengine>goapp serve myapp
Traceback (most recent call last):
File "C:\Users\kirill\Desktop\go_appengine\\dev_appserver.py", line 83, in <module>
_run_file(__file__, globals())
File "C:\Users\kirill\Desktop\go_appengine\\dev_appserver.py", line 79, in _run_file
execfile(_PATHS.script_file(script_name), globals_)
NameError: name 'execfile' is not defined
error while running dev_appserver.py: exit status 1
Go AppEngine SDK requires Python 2.7 (Python 3.x cannot be used). It looks to me your SDK is using Python 3.X or you don't have Python at all (in your PATH).
First make sure Python 2.7 is added to your PATH so that will be used by goapp. You can get it here: Python 2.7.11. For the Go AppEngine SDK a small, portable Python is also enough, you can get it from here: Single-File Stand-alone Python 2.7.9 for Windows. Download pyexe-2.7.9.10.zip and extract it. It's just a 10 MB single file, rename it to python.exe and add it to your PATH.
Also going further, it looks to me you are starting your Hello world app from the wrong folder: you are standing in the SDK's folder, and you want to start it specifying that your app is in the myapp subfolder inside your SDK, which is unlikely.
Navigate to the folder where you app is (app.yaml must be there). In that folder execute the command
goapp serve
This will start the app being in the current folder. For this to work, the goapp command (goapp.bat on windows) must be added to your PATH.
If you can't or don't want to add your go_appengine folder to your PATH, still navigate to the folder containing the app you want to start, but provide the path for goapp, e.g.
C:\Users\kirill\Desktop\go_appengine\goapp serve
I've just stumbled upon similar issue myself, In Python 3
Instead of
execfile("./filename")
Use
exec(open("./filename").read())
I'm having issues getting started using GAE (1.7.6 on OS X 10.6.8 with Python 2.7) and compared to amazon services it is abysmal. However, I would like to at least get the sample app deployed. After working through the other issues I now have a small sample application ready to deploy. When I try to deploy it, I receive an SSL error as follows:
*** Running appcfg.py with the following flags:
--no_cookies --email=mathsboy#gmail.com --passin update
02:15 PM Host: appengine.google.com
02:15 PM Application: tew-helloworld; version: 1
Traceback (most recent call last):
File "google_appengine/appcfg.py", line 171, in <module>
run_file(__file__, globals())
File "google_appengine/appcfg.py", line 167, in run_file
execfile(script_path, globals_)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 4155, in <module>
main(sys.argv)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 4146, in main
result = AppCfgApp(argv).Run()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 2334, in Run
self.action(self)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 3881, in __call__
return method()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 2892, in Update
updatecheck.CheckForUpdates()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/sdk_update_checker.py", line 258, in CheckForUpdates
runtime=runtime))
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appengine_rpc.py", line 393, in Send
f = self.opener.open(req)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 394, in open
response = self._open(req, data)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 412, in _open
'_open', req)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 372, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1207, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/fancy_urllib/fancy_urllib/__init__.py", line 383, in do_open
url_error.reason.args[1])
fancy_urllib.InvalidCertificateException: Host appengine.google.com returned an invalid certificate (_ssl.c:503: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed):
To learn more, see http://code.google.com/appengine/kb/general.html#rpcssl
If deploy fails you might need to 'rollback' manually.
The "Make Symlinks..." menu option can help with command-line work.
*** appcfg.py has finished with exit code 1 ***
There was some advice on this in another thread stating that you would need to remove cacerts.txt, though I am unable to locate this file on OS X. Also, it seems retarded that in order to have the code upload I'd have to delete a cacert text file. But maybe I'm an idiot.
Another problem I'm facing here, is that OS X doesn't work well with GAE due to the difficulty in managing python versions. I've got a total mess on my hands now after installing multiple versions of python, EPD, ActiveState, MacPorts. None of these worked in solving me earlier problems despite assurances they would. It's really pretty appalling that this is the state of google's application management. It just seems like GAE was built by a bunch of guys from mid-90s microsoft....anyone advice on the above issue would be greatly appreciated. Cheers
Fourth line from end in your error. Relevant instructions under the link.
http://code.google.com/appengine/kb/general.html#rpcssl
Make sure (from documentation):
To do this you must have the ssl Python module installed on your system.
Workaround: Use the command line argument --skip_sdk_update_check=yes when you run dev_appserver.py.
I had the same problem and noticed the GUI tool (GoogleAppEngineLauncher) uses --skip_sdk_update_check=yes every time you start an app. This is as of SDK 1.8.7.
The root cause seems to be a known bug in the GAE development server's module whiltelisting system. Even if you have the ssl module installed (as the documentation says is required), ssl relies on _ssl, which is not whitelisted. This is why you can execute import ssl in a regular python shell session with no problem, but get an error when you execute the same line in a GAE app.
I attempted to use Appengine SDK version 1.7.6 but was receiving fatal errors (same as outlined below) so reverted to 1.7.5, where my app works fine. However, the errors I saw in 1.7.6 recur when I attempt to run the experimental devappserver in 1.7.5. I am running Python 2.7 on a win 7 machine. Standard install selections for AppEngine.
These error messages refer to permissions relating to the PYTHON_EGG_CACHE, but...
- 1) They do not occur for the 'old' dev_appserver
- 2) The application can successfully extract files to the location noted. In fact, I changed the path of the PYTHON_EGG_CACHE to another location, gave it wide open permissions, and still received the error.
- 3) I have pyyaml in my site-packages, so am not sure why it would need to do a temporary extract anyway.
Any help looking for a resolution to this would be appreciated, since I'll be forced to use the new devappserver in a couple of releases time.
Command line error dump below:
python "C:\Program Files (x
86)\Google\google_appengine\devappserver2.py" .
WARNING 2013-03-25 19:10:41,029 devappserver2.py:497] devappserver2.py is curre
ntly experimental but will eventually replace dev_appserver.py in the App Engine
Python SDK. For more information and to report bugs, please see: http://code.go
ogle.com/p/appengine-devappserver2-experiment/
INFO 2013-03-25 19:10:41,171 appcfg.py:618] Checking for updates to the SDK.
WARNING 2013-03-25 19:10:44,525 simple_search_stub.py:975] Could not read searc
h indexes from c:\users\ben\appdata\local\temp\appengine.dev~upskillme-main.Ben\
search_indexes
INFO 2013-03-25 19:10:44,539 api_server.py:148] Starting API server at: http
://localhost:49302
INFO 2013-03-25 19:10:44,555 dispatcher.py:96] Starting server "default" run
ning at: http://localhost:8080
INFO 2013-03-25 19:10:44,571 admin_server.py:112] Starting admin server at:
http://localhost:8000
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\_python_runtime.py", line
150, in <module>
run_file(__file__, globals())
File "C:\Program Files (x86)\Google\google_appengine\_python_runtime.py", line
146, in run_file
execfile(script_path, globals_)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\de
vappserver2\python\runtime.py", line 39, in <module>
from google.appengine.ext.remote_api import remote_api_stub
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\remo
te_api\remote_api_stub.py", line 75, in <module>
import yaml
File "C:\Program Files (x86)\Google\google_appengine\lib\yaml-3.10\yaml\__init
__.py", line 14, in <module>
from cyaml import *
File "C:\Program Files (x86)\Google\google_appengine\lib\yaml-3.10\yaml\cyaml.
py", line 5, in <module>
from _yaml import CParser, CEmitter
File "C:\Python27\lib\site-packages\pyyaml-3.10-py2.7-win32.egg\_yaml.py", lin
e 7, in <module>
File "C:\Python27\lib\site-packages\pyyaml-3.10-py2.7-win32.egg\_yaml.py", lin
e 4, in __bootstrap__
File "C:\Python27\lib\site-packages\pkg_resources.py", line 882, in resource_f
ilename
self, resource_name
File "C:\Python27\lib\site-packages\pkg_resources.py", line 1351, in get_resou
rce_filename
self._extract_resource(manager, self._eager_to_zip(name))
File "C:\Python27\lib\site-packages\pkg_resources.py", line 1406, in _extract_
resource
manager.extraction_error() # report a user-friendly error
File "C:\Python27\lib\site-packages\pkg_resources.py", line 928, in extraction
_error
raise err
pkg_resources.ExtractionError: Can't extract file(s) to egg cache
The following error occurred while trying to extract file(s) to the Python egg
cache:
[Error 5] Access is denied: 'C:\\Users\\Ben\\AppData\\Roaming\\Python-Eggs\\py
yaml-3.10-py2.7-win32.egg-tmp\\_yaml.pyd'
The Python egg cache directory is currently set to:
C:\Users\Ben\AppData\Roaming\Python-Eggs
Perhaps your account does not have write access to this directory? You can
change the cache directory by setting the PYTHON_EGG_CACHE environment
variable to point to an accessible directory.
Exception in thread Thread-4:
Traceback (most recent call last):
File "C:\Python27\lib\threading.py", line 551, in __bootstrap_inner
self.run()
File "C:\Python27\lib\threading.py", line 504, in run
self.__target(*self.__args, **self.__kwargs)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\de
vappserver2\server.py", line 1045, in _loop_adjusting_instances
self._adjust_instances()
If anyone comes along with the same issue, the resolution that worked for me was as follows:
Unzip the PyYAML-3.10-py2.7-win32.egg in your python27 site-packages
directory into a new directory within site-packages. You'll need to
unzip it to into a directory name like NEWPyYAML-3.10-py2.7-win32.egg
to avoid name conflicts.
Rename your original egg. to something else (e.g., OLDPyYAML-3.10-py2.7-win32.egg).
Rename your new directory to PyYAML-3.10-py2.7-win32.egg
All references to the egg will now actually point to a directory in your site-packages containing the unzipped python files. The new devappserver should be able to work with this.
Unsure how to unzip an egg in windows? See here (presuming you have Winzip or similar installed):
http://mail.python.org/pipermail/chicago/2007-July/002301.html
I Have a test app that is configured python25 that opens a text fie in the root folder and is then loaded by cPickle.
the code is based on gae-nltk
I have migrated the code to python27 and i get the following error in log console of development kit using the latest sdk v1.7.0 timestamp: 1337717865
api_versions: ['1']
File "C:\Program Files\Google\google_appengine\lib\webapp2\webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "C:\APPS\v2\knol_handlers.py", line 267, in get
kwds1 = Reply(tb1)
File "C:\APPS\v2\knol_handlers.py", line 108, in Reply
tok = pickle.load(open(os.path.join(os.path.dirname(__file__), "site-packages\\english.pickle")))
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 592, in __init__
raise IOError(errno.EACCES, 'file not accessible', filename)
IOError: [Errno 13] file not accessible: 'C:\\APPS\\v2\\site-packages\\english.pickle
I have looked into configuration docs for python27 but I guess i am missing something.
Any help appreciated.
murray3
UPDATE = The file was available to be read when I moved it from root to subfolder site-packages. I upgraded to sdk version 1.7.0 and the file acess problem has resurfaced.
the file is not marked as static in app.yaml
OK lesson learned - be careful using so called boiler plate templates.
there was a reference in app.yaml that would include this as static.
I reverted to a basic app.yaml and problem is gone.