I'm new to Google App Engine and I followed multiple video tutorials (One from Udacity) and for some reason I am unable to get it to run on the local host with the simple "Hello World" program.
I do have the Python SDK installed as well as the Google App Engine program installed. I did modify the YAML file so that it matches with my application (it did by default). When I click "run" in the Google App Engine launcher, it shows a yellow triangle caution sign next to the program I'm attempting to run.
When I type the localhost:8080 in the search bar it says:
This webpage is not available
I've also tried reinstalling both Python 2.7.9 and the Google App Engine and to no avail. In short I would like to understand why the program shows no content when I attempt to run it. Here are the log files if it's any help:
2015-03-14 18:36:21 Running command: "['E:\\Python\\pythonw.exe', 'C:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py', '--skip_sdk_update_check=yes', '--port=8080', '--admin_port=8000', 'C:\\Program Files (x86)\\Google\\google_appengine\\new_project_template']"
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\dev_appserver.py", line 83, in <module>
_run_file(__file__, globals())
File "C:\Program Files (x86)\Google\google_appengine\dev_appserver.py", line 79, in _run_file
execfile(_PATHS.script_file(script_name), globals_)
NameError: name 'execfile' is not defined
2015-03-14 18:36:21 (Process exited with code 1)
It looks like the default pythonw on your system (E:\Python\pythonw.exe) is some version of Python 3. That's where execfile is indeed not defined (and the GAE launcher's incompatible with Py3 in other ways, anyway, at this time).
To verify, run E:\Python\python.exe at a cmd prompt -- it should greet you with a version banner which I bet will mention Python 3.something.
Where did you (re-)install 2.7.9? How's your PATH environment variable? Likely with E:\Python before wherever 2.7.9 is installed.
Simplest might be to change your PATH so that wherever 2.7.9 is installed comes before E:\Python...!
Related
I try to install the latest version of postgres sql using the latest version and the recommended set up.
However when I open the pg adming I receive this error.
Python Path: "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\python.exe"
Runtime Config File: "C:\Users\User\AppData\Roaming\pgadmin\runtime_config.json"
pgAdmin Config File: "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\config.py"
Webapp Path: "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgAdmin4.py"
pgAdmin Command: "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\python.exe C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgAdmin4.py"
Traceback (most recent call last):
File "../web/pgAdmin4.py", line 98, in <module>
app = create_app()
File "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgadmin\__init__.py", line 347, in create_app
if not os.path.exists(SQLITE_PATH) or get_version() == -1:
File "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgadmin\setup\db_version.py", line 19, in get_version
return version.value
AttributeError: 'NoneType' object has no attribute 'value'
Any help on how to fix it?
After trying all the other suggestions without success, it finally worked for me now, with the way suggested here: Get fatal error: server could not be contacted when running pgAdmin4. 'NoneType' object has no attribute 'value'
Install the newest version of the standalone pgAdmin from https://www.pgadmin.org/download/pgadmin-4-windows/
(you can do the installation additionally to the existing bundled version, without having to remove anything before)
Delete the C:\Users\your_username\AppData\Roaming\pgadmin folder
(I restarted the postgres service once again)
Run the new pgAdmin as Administrator - it works!
Several people report that, from then on, even the old bundled version of pgAdmin works fine!
I resolved in this way:
I removed PGadmin from "Application Stack Builder"
download last version v4 5.2 (pgAdmin 4 v5.2 (released April 22, 2021)
installed...
lunched like admin... (error as usual)
clean-up folder C:\Users\XXXXX\AppData\Roaming\pgadmin (opsssss)
lunched like admin... All ran successfully!
Using all in one PGadmin with Application Stack gave me an usual error bind to some pyton or configuration file
Alen
I had a lot of trouble launching pgAdmin. Several solutions are there.
Try an older version of pgAdmin. The latest version might have unresolved issues.
Go to %APPDATA% (C:\Users{{your username}}\AppData\Roaming) folder and delete the pgadmin folder and run again.
go to environment variables (search environment on search bar) -> advanced, the click on Environment Variables. On System Variables click on path and set a new path for C:\Program Files\PostgreSQL\13\bin (the address might vary on your PC)
I am trying to run the appengine-endpoints-helloendpoints-python app locally using the google cloud platform SDK (which has been added to my path) using the command dev_appserver.py from the command line. It used to run perfectly, but now when I try, I get an error:
Error processing line 2 of
/Users/hannah/anaconda3/envs/py27/lib/python2.7/site-packages/grpc_google_pubsub_v1-0.8.1-py2.7-nspkg.pth:
Traceback (most recent call last):
File "/Users/hannah/anaconda3/envs/py27/lib/python2.7/site.py", line 161, in addpackage
exec line
File "<string>", line 1, in <module>
KeyError: 'google'
Remainder of file ignored
It's in a anaconda python2.7 environment. I've tried looking in site.py but I can't follow it back to a clear missing link.
The appcfg.py command used to deploy from the command line doens't work at all anymore. The command is not found.
bash: appcfg.py: command not found
As I said, I reinstalled and authorised the google cloud SDK and it is added to my path and that hasn't solved anything.
Oh finally, the error comes up whenever I run the dev_appserver.py command, not just with the example code from google.
Any tips would be appreciated
I have both Python 3.5.2 and Python 2.7.12 Installed (On Windows). But when I try to deploy from Using Google App Engine SDK for Python, I receive this error message:
in <module>
run_file(__file__, globals())
File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 129, in run_file
execfile(_PATHS.script_file(script_name), globals_)
NameError: name 'execfile' is not defined
2016-08-17 11:28:50 (Process exited with code 1)
I can only deploy from the command line:
C:\Python27\python.exe "C:\Program Files (x86)\Google\google_appengine\appcfg.py" update app.yaml
Is there a way to deploy with Python 2 and not Python 3? Without using the command line? And how do I report to Google about this bug, I think if they want they can fix it for Google App Engine SDK.
You need to select the correct Python path, when you have multiple copies of Python the wrong path might be selected as the default.
Usually it's C:\Python27\pythonw.exe however it may be something else if you changed that during installation.
Go to the Google App Engine Launcher and change the path to the one you want in Edit/Preferences.
I'm compiling a python application using pyinstaller.
The structure is like so -
d:\app\myprog.exe
d:\app\config\settings.conf
If I run myprog.exe --switch value from d:\app it runs fine, if I try to run from anywhere else like c:\windows it's not finding my settings.conf file complaining with the message:
Traceback (most recent call last):
File "<string>", line 284, in <module>
File "<string>", line 218, in main
File "ConfigParser.py", line 330, in get
ConfigParser.NoSectionError: No section: 'database'
myApp returned -1
database being the first line in the config file I'm trying to reference.
I'm referencing the BASE_DIR from the app here -
# Global Path and Config Info
try:
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
except NameError: # We are the main py2exe script, not a module
BASE_DIR = os.path.dirname(os.path.abspath(sys.argv[0]))
So that I can get the config file like this -
config = RawConfigParser()
config.read(os.path.join(BASE_DIR, 'config/settings.conf'))
But I guess BASE_DIR is whatever folder I'm running the EXE from (like c:\windows, not the location of the EXE (which is d:\app)?
As mentioned in PyInstaller documentation (in How the One-File Program Works section) when a single executable file (created by PyInstaller) is executed, what happens is that a directory structure of the required library modules (Python VM, libraries and packages, etc.) are extracted from that single executable to a temporary directory, and then the application is started from there.
This means that __file__ in your Python code is not going to be the path to the single executable file, and that's the reason for this issue.
I'd write my app to accept the path to the configuration file from command line arguments, fall back to using an environment variable if available, and then a hard coded default value based on the platform (as most multi platform applications do to reach to their configurations).
Another approach is to use the one-directory output from PyInstaller and include the configuration file in the same directory.
Then to help make it easier to distribute the software to end users, use another tool to create a single Windows installer file from that directory structure. This way you'll be distributing the Windows installer, so users can run to install the application. But when the app runs, it runs from the directory where the configuration file resides.
I'm fairly new to programming and decided to setup a simple python script that would open all the applications I use for webapp development. The code I am using is (for GAE):
google_appengine = r'C:\Applications\google_app_engine\launcher\GoogleAppEngineLauncher.exe'
subprocess.Popen(google_appengine)
This works fine for the other programs I am opening, but I am unable to run any applications within App Engine after I have opened it this way. I get the following error in my App Engine log file:
Exception in thread Thread-2:
Traceback (most recent call last):
File "threading.pyc", line 486, in __bootstrap_inner
File "launcher\taskthread.pyc", line 65, in run
File "subprocess.pyc", line 587, in __init__
File "subprocess.pyc", line 700, in _get_handles
File "subprocess.pyc", line 745, in _make_inheritable
WindowsError: [Error 6] The handle is invalid
I'm guessing it is the way subprocess.Popen() works, but I haven't been able to find any alternatives. I'm running Windows 7 if that makes a difference. Thanks for looking.
if you want to manage the local dev_appserver, this is the wrong approach.
the best way to do this is clone the sdk repository (https://code.google.com/p/googleappengine/) directly to your drive and then add that path to your environment PYTHONPATH variable.
here's a link to a script template i created & often use to manage startup & killing of the dev_appserver process: https://gist.github.com/4514647
i'm not too familiar with managing a python environment on Windows, so you'd have to take my notes on a highlevel and research the specific implementation for that platform.