I am just starting to use Python GAE in Windows 7.
Based on my observations, it seems like changes that I make to the python scripts in my
local app engine directory do not show up when I launch the code to my 'localhost:XXXX' sandbox.
For example, I'll import one of my scripts and invoke some functions, and I get the error below.
The weird thing about this error is that the 'exec()' call is no longer at line 99 in the copy of 'main.py' that I have been revising.
Traceback (most recent call last):
File "/base/data/home/apps/[app name]/1.354953192642593048/main.py", line 99, in post
exec(cmd, safe_globals)
File "<string>", line 5, in <module>
NameError: name 'myFunction' is not defined
I guess my questions are:
1) What/where is '/base/data/home/apps/[app name]/1.354953192642593048/main.py'? Is this where they compile and run everything?
2) How can I 'rebuild' the local copy of my app folder such that the revisions I make are reflected in the sandbox?
Sorry for this relatively vague question. If somebody could explain how the sandbox is setup so I can figure out how to properly do debugging I would appreciate it.
UPDATE:
Never figured out how / why this error occurred. The output from that app engine directory was totally static no matter what kind of changes I tried to make, so I just deleted the folder and opened a new one. With this new folder (same exact contents, including app.yaml and main.py), I can make changes on the fly and my local debugger reflects those changes.
No longer a pressing issue, but if anybody has an idea as to how / why this error was occuring, I would be interested to hear it. As suggested in the comments below, the path provided in the error message is highly indicative of the workings of some remote base/ directory, even though I have been running everything on my localhost:[Port#] without any app deployment.
Are you sure you're running it locally? The traceback looks like it's from the app server. The '/base/data/home/apps/[app name]/1.354953192642593048/main.py' looks like the path to your application on Google's app server, not a Windows file path.
Related
As the title suggests, I'm looking for a way to run local python scripts from the Google Apps Scripts environment. Right now my method is to write a json file from app scripts and save it to a Google Drive directory. The local machine polls the directory via Google Drive File Stream, and runs the necessary code when the file appears in the directory. Not pretty, but it gets the job done. The main concern with this is that File Stream can be fairly latent - could be up to 15 minutes after a file is put in the directory before File Stream catches it and syncs the local machine.
Is anybody aware of other options? I could try re-writing the python code in Apps Script, though the python code relies on a few third party libraries that aren't available in JS. Another idea is setting up a flask server, but that seems like a good bit of work for the return.
I'm deploying my Python app on GAE using the command line interface, which has always worked without problems. Since yesterday, one of the modules is getting stuck on "Scanning 500 files" and in the end throws following error:
Another transaction by user jong.vincent is already in progress for app: s~replimeapp, version: uno. That user can undo the transaction with "appcfg rollback".
However when I rollback updates for this app, the error is still thrown on the next deployment. No clue what I can do to resolve this. There is another module which refers to the same files, which has no problem deploying. No clue what I can do to get rid of this. Help please!
Changed the name of the module and then it worked. Very strange, but at least the problem is solved.
It is really weird that after clicking run button, it does nothing and also no log and show a clock sign on the first column.
It works normally before. However, after I messed up my python environment, the google coursebuilder can't run web application. That's my guessing. When I run which python.it only shows:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
These let me feel like I have no way to solve it!Are there anyone who came across this problem before? Any ideas or suggestions?
Updated: I follow suggestions to use command line to run web application on GAE. It reminds me here:
Update: The error message shows that GAE can't get the allocated port and domain. The reason why it happens is that when I use command line to run the web application, I also open GAE GUI to run a web app with the same port number.
So the way to solve it is to close the GAE GUI and free the port. Or we also could designate another kind of port number with command line.(--port=XXXX and --admin_port=YYYY). Or take a look at the doc:
Again thanks for the help of Mihail R!
The OP had multiple issues with GAE setup which were resolved by simply reinstalling the GAE Launcher and making sure the app was first copied into Applications from the .dmg file, then ran from the Applications instead of from inside the .dmg file, and appropriate permissions were suppose to be given so that GAE Launcher created the symlinks it needed to work properly.
More instructions on proper GAE SDK installation can be found here: https://cloud.google.com/appengine/downloads after clicking on the needed SDK and then the OS the SDK will be installed on.
Just installed Google Apps Engine and am getting "could not save" errors.
Specifically if I go in to preferences I get
Could not save into preference file
C:\Usera\myname/Google\google_appengine_launcher.ini:No such file or directory.
So some how I have a weird path, would like to know where and how to change this. I have search but found nothing, I have done a repair reinstall of GAE
Can find nothing in the registry for google_appengine_launcher.ini
I first saw the error when I created my first Application
Called hellowd
Parent Directory: C:\Users\myname\workspace
Runtime 2.7 (PATH has this path)
Port 8080
Admin port 8080
click create
Error:
Could not save into project file
C:\Users\myname/Google\google_appengine_launcher.ini:No such file or directory.
Thanks
I think I have found the answer to my own question.
I have a small app I have written to backup my stuff to Google Drive, this app would appear to have an error in it that does not stop it from running but does cause it to make a file called
C:\Usera\myname\Google
Therefore GAE can not create a directory called C:\Usera\myname/Google nor a file called C:\Usera\myname/Google\google_appengine_launcher.ini
I deleted the file Google, made a directory called Google and ran the GAE, saved pereferences and all working
Committed a small code change to my django app and deployed to heroku. The app now throws H10 (app crashed) errors on every response. When I checked the logs, I saw..
[web.1]: Traceback (most recent call last):
[web.1]: File "nightlife2/manage.py", line 2, in <module>
[web.1]: from django.core.management import execute_manager
[web.1]: ImportError: No module named django.core.management
[web.1]: bash: bin/gunicorn_django: No such file or directory
..which I know means that django isn't on the pythonpath. I looked at the PATH on the heroku config which says bin:/usr/local/bin:/usr/bin:/bin. But while doing a heroku run bash, I noticed that the entire bin directory is now gone. Other apps of mine deployed on heroku can still be pushed to and still have the bin directory on there (I believe newer apps no longer have the bin directory and it's now in .heroku/venv/bin. Not 100% sure on the details there)
Has anyone ever encountered this? I can change the PATH to .heroku/venv/bin but then I get an error about sql and I don't know if this is closer or farther away from the root problem. ANYTHING would be greatly appreciated as this is the production server and is currently hosed.
EDIT: The error when changing the path is: django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named _sqlite3
. The database is postgress so I'm not sure where this is coming from
I resolved the issue. It was a combination of things. I'll document here and hopefully saves someone the headache I just experienced.
Our database had just been updated to the new Heroku Postgres dev plan. (Unsure if this is related or not). This was the first push of code since the database had been updated.
A while back I remember hearing about settings injections being deprecated. Being naive, we did nothing about it and never saw any changes so never followed up about it. They decided to take effect today and broke the linking to our postgres database. I'm still unsure as to why the bin directory is now gone, but it appears that the app is now using the new .heroku/venv/bin. To fix all of this, I had to change the settings.py to use the new postgres declaration for the database. I was correct in my OP that the PATH variable in the heroku config needed to be updated to point to the .heroku/venv/bin directory. I then had to update the Procfile because it was complaining about bin/gunicorn_django not being found. Once everything was updated, pushing the code solved the issue