When I run my app, my app engine logs give me this error:
WARNING 2012-03-01 23:27:31,089 py_zipimport.py:139] Can't open
zipfile/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-
packages/setuptools-0.6c11-py2.7.egg:
IOError: [Errno 13] file not accessible: '/Library/Frameworks/Python.framework/
Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg'
What does this mean?
Errno 13 is EACCES. It means "permission denied". So the access permissions do not allow you to access that file. Check the permissions with ls -l /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg
A list of error names and explanations is usually found in the manual page for errno, or the C include file errno.h.
This may happen after building a new library. For example, it happened to me after building lxml. Remake your symlinks from the appengine and it should fix your issue.
The answer you have marked as accepted isn't helpful. An annoying bug in the App Engine SDK actually throws these errors when running the development server with Python 2.7. Here's how I fixed it:
Edit the file <local path to app engine>/google/appengine/tools/dev_appserver_import_hook.py
On most systems the local path to App Engine is /usr/local/google_appengine
Search for py27_optional=False (around line 477) and replace it with py27_optional=True
Every time you update your local App Engine SDK, you will need to redo this patch.
Credit Carl D'Halluin
Related
I wrote a script that checks some secrets within an OpenShift cluster. I used the python rest-client library for Openshift and the script is executed within the cluster. But i always get IOError: [Errno 2] No such file or directory: '/home/jenkins/.kube/config'
I know that I don't have a kube config in the pod and therefore I tried to use the kubernetes.config.load_incluster_config() method to enable the in cluster config.
from kubernetes import client, config
from openshift.dynamic import DynamicClient
config.load_incluster_config()
k8s_client = config.new_client_from_config()
dyn_client = DynamicClient(k8s_client)
I would assume that it is no longer necessary to provide a kube config with the load_incluster_config call. Did someone solve the problem with the rest client and openshift in cluster execution with a service account?
I appreciate any help, thanks.
I mean, you've probably already checked this, but are sure that you're in the right directory? Because running a file from the wrong directory can cause the error of "No such file or directory".
I solved it with the following:
if os.getenv('KUBERNETES_SERVICE_HOST'):
config.load_incluster_config()
else:
config.load_kube_config()
dyn_client = DynamicClient(ApiClient())
ApiClient is using the default configuration.
Deploying Google Cloud Functions from the local system fails with the following error:
ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Function load error: File main.py that is expected to define function doesn't exist
I've used the console UI to check the contents of the package that was uploaded in the failed deployment and the file is present. The package was created using the gcloud CLI:
gcloud functions deploy <redacted> \
--trigger-http \
--runtime=python37 \
--region=europe-west1 \
--project=<redacted> \
--entry-point=<redacted>
For context, the same project was deployed successfully multiple times by several people but started failing for everyone new that checked it out after a specific date.
In our case, this was because of invalid credentials, i.e. the JSON file passed to ServiceAccountCredentials.from_json_keyfile_name was missing. Confusingly, the error doesn't mention anything about security, credentials or that missing file.
Secrets are not in version control and the shared vault had a stale file that did not match the path provided in the python script. This was fixed once the credentials were corrected.
We managed to isolate the problem to the authenticated call by successfully deploying 'dumb' functions (return a string) and then incrementally adding back functionality until it broke.
I solved this problem in my application in Node.js, basically I identified that the .gcloudignore file it invokes the .gitignore of the project, so if your function is in a skipped folder it simply does not find, then just remove the line #! Include : .gitignore file .gcloudignore
I am trying to push a Python (3.6.5) app via Flask to Cloud Foundry (cf version 6.36.1+e3799ad7e.2018-04-04). The application takes a POST request (text file), does some text transformation, saves the new file, and returns a confirmation message. It works locally (tested via Postman). However, when attempting to push it to CF, it gives the following error -
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ygzuah5g/logging/
Could you please let me know how I can go about solving this issue? Thanks in advance. The entire files together are ~ 350 MB. I am using a manifest.yml
---
applications:
- name: textsum
memory: 512M
command: python server.py
buildpack: https://github.com/cloudfoundry/buildpack-python.git
PS - Not sure if this is helpful, I do have import queue in one of my files. If I change it to import Queue (Py 2x compatible) and use Py 2.7.15 runtime, the cf push is successful, but it throws runtime errors
ERROR in app: Exception on / [POST]
File "/home/vcap/deps/0/python/lib/python2.7/subprocess.py", line 1047, in _execute_child
ERR raise child_exception
ERR OSError: [Errno 2] No such file or directory
ERR 10.0.65.11 - - [12/Jun/2018 20:56:16] "POST / HTTP/1.1" 500 -
First. Don't do this in your manifest.yml:
buildpack: https://github.com/cloudfoundry/buildpack-python.git
This is telling Cloud Foundry to use the master branch of the buildpack which can change quite frequently and there are no guarantees of it's fitness (i.e. it could even be broken).
Instead, make sure that you are using a release. Releases are tested and the code won't change out from under you.
You can do this by using the platform supplied Python buildpack, simply remove this line or put python_buildpack as the name, or you can point to buildpack: https://github.com/cloudfoundry/buildpack-python.git#v1.6.17 where v1.6.17 is a release from here.
https://github.com/cloudfoundry/python-buildpack/releases
Second, it seems like you need to tell Cloud Foundry & the buildpack which version of Python you want. If you need Python 3, then you should tell it that. See here for instructions on doing that.
https://stackoverflow.com/a/50837696/1585136
Third, this error:
ERR OSError: [Errno 2] No such file or directory
Seems like you're trying to write to a location that does not exist. Where are you trying to write your file? The paths will be different on your local machine vs running on Cloud Foundry. Typically on Cloud Foundry, you would write temporary files to /home/vcap/tmp or /app/tmp (/app is a symlink to /home/vcap) or $HOME/tmp. They all point to the same place.
I'm specifically mentioning temporary files here because you don't want to write permanent files to the local file system on Cloud Foundry. The local file system is ephemeral and your data will not persist for very long. See here for details.
https://docs.cloudfoundry.org/devguide/deploy-apps/prepare-to-deploy.html#filesystem
Hope that helps!
I have this error appearing in my Django app on my production server :
[Errno 13] Permission denied: '/var/www/.config'
I never asked to access to this unexisting file or directory in my code. The server is running in a different directory defined in my httpd.conf and I haven't defined the use of any /var/www/ elements in my Django settings.
In my case I'm using the biopython library with Django :
from Bio import Entrez
Entrez.email = "my#email"
handle = Entrez.efetch("taxonomy", id="123, 1")
records = Entrez.parse(handle)
This code is working in a python console on the server. But the instruction Entrez.parse(handle) return the error in a Django environment.
I haven't seen any instruction asking to write or open anything in the source code of the function so it seems to be a problem with Django?
Is it a configuration problem? A background Django function trying to access to a file when I call a specific function?
My configuration :
Python 3.3
Django 1.8
Biopython 1.67
In facts, Entrez.parse is calling the DataHandler objects. This objects try to write in the user directory with something like :
home = os.path.expanduser('~')
directory = os.path.join(home, '.config', 'biopython')
local_xsd_dir = os.path.join(directory, 'Bio', 'Entrez', 'XSDs')
os.makedirs(local_xsd_dir)
Because biopython user is the httpd user, the home directory is /var/www/.
The solution is here to allow apache to write into /var/www or to move it to a different place.
Restart the server or restart the service of django.
That is important, because the services in the background have to know the new location of the configuration.
I guess it works on python, because the library is loading the actual settings and the background service is using the old one.
Hope I could help
I have a problem with google app engine. It used to work but now I can't figure out whats wrong...
python: can't open file 'google_appengine/dev_appserver.py': [Errno 2] No such file or directory
apologize for the delay in getting back to this.
1) it happens when command is executed outside google_appengine directory e.g.
abid#abid-webdev:~/Documents/GAE_projects/helloworld$ python google_appengine/dev_appserver.py helloworld/
python: can't open file 'google_appengine/dev_appserver.py': [Errno 2] No such file or directory
2) now when i run from the directory where i have
"google_appengine folder" and project, it works grand :)
abid#abid-webdev:~/Documents/GAE_projects$ ls
google_appengine helloworld
abid#abid-webdev:~/Documents/GAE_projects$ python google_appengine/dev_appserver.py helloworld/
Allow dev_appserver to check for updates on startup? (Y/n): y
dev_appserver will check for updates on startup. To change this setting, edit /home/abid/.appcfg_nag
3) another thing i noticed, google docs says->[https://developers.google.com/appengine/docs/python/gettingstartedpython27/helloworld][1] to use ->
google_appengine/dev_appserver.py helloworld/ this command -
whereas i used
python google_appengine/dev_appserver.py helloworld/ as suggested on udacity forums->
http://forums.udacity.com/questions/6003945/with-opensuse-121-the-python-app-refuses-to-work
thanks all for your help. cheers