Google App Engine deployment: missing file - python

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

Related

why when i launch my app with emrun i received .py missing?

i want try to deploy one little browser application. (it's only a button that do nothing). When I try to debug and run my app with emrun, I receive:
C:\Users\Acer\AppData\Local\Programs\Python\Python39\python.exe: can't open file 'C:\.py': [Errno 2] No such file or directory
I had understand that ".py" is missing but I don't know how to fix it.
I'm using window 10.
The path to the file is wrong
It tries to open the file in the dir 'C:' what is not correct.
Change the file to the dir where the file is saved.

No such file or directory on Mac terminal for python

hello.py is my first python program. It is saved on my desktop.
In the terminal I write in front of
user#AA-MacBook-Air ~ % python3 hello.py
The error is
can't open file 'hello.py': [Errno 2] No such file or directory
Kindly help me understand the problem and solve it.
In the terminal you are currently in the directory ~. This signifies the folder /Users/<username>. Your script is on your desktop.
Type cd Desktop to change to /Users/<username>/Desktop and then run python3 hello.py.
you first need to change destination with cd
The error message, No such file or directory pretty much gives the explanation. Check if the file hello.py is present in the correct working directory. This can done graphically or using the ls command. If it is not present, copy the file the to the directory or navigate to the location of the file hello.py in terminal using cd.

Don't understand the why configparser can't find the config file

I'm using cofigparser in my python project. Directory structure is as following:
root/dir/data.py
root/dir/config.ini
data.py code:
config_parser = configparser.RawConfigParser()
config_file_path = "data/config.ini"
config_parser.read_file(open(config_file_path))
This works from local machine. But when Im trying to build it from Jenkins, output is:
> config_parser.read_file(open(config_file_path)) 19:09:04
> FileNotFoundError: [Errno 2] No such file or directory:
> 'data/config.ini'
After many attempts to resolve it I find out, that from Jenkins it works only if I include root to the path, so as I change it as following:
config_file_path = "root/data/config.ini"
It starts working on Jenkins. But - I have above error message on local machine now. So now Im in the situation, that if I can run my code from local machine, I have to change that path, and don`t forget to change it back, when Im commiting changes to git. Has anybody any idea, why is that? And how to write the path which will work on both?
Note1:
All the imports Im using in project are without root directory included, so for example:
from dir.dir2 import foo
If I include root dir, it never works from Jenkins.
Note2:
Both machines running Windows.

Django how to read a file in the app subdirectories folder?

I am using Django to build a Web application, and there is python module inside the app folder. This python module needs to interact with yaml in the subdirectories "input" and "output".
map_local_path = "./input/map.yaml"
I just tried to read this path, it will work at my local spyder ide, but it wont work when it comes to Django.
I want to call my own python module api in views.py, and what I am doing is to:
openFile = open("./input/map.yaml", "r")
and I cannot make it work at Django.
How can I fix it? T_T Thanks!
IOError: [Errno 2] No such file or directory: './input/map.yaml'

File not accessible error (setuptools) in logs

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

Categories