The logging.debug statements are not printed by default in the local development server of Google App Engine projects. In order to display these messages, you need to add the "--debug flag" to the launch settings. Here are the steps to do so:
1. Open GoogleAppEngineLauncher
2. Right-click on your app engine project
3. Select Info...
4. In the Launch Settings section, enter "--debug" in the Extra Flags box.
5. Click Update.
Restart the server. The Logs should now display DEBUG statements in addition to warnings and info.
Wednesday, April 28, 2010
Thursday, April 8, 2010
Unzipping jar files
Wow, opening jar files is much easier than I realized! I had been expanding them from the command line for a couple years now. Today, I just found this page: http://ostermiller.org/opening_jar_files.html. All I have to do on my Mac is change the extension to .zip and double click. Wow.
Sunday, April 4, 2010
Installing rdflib - Mac OS X 10.5.8
Installing rdflib seems easy enough, but I ran into a couple of weird issues that were not documented anywhere online. I wanted to share my experience in case anyone else ran into these same problems!
First, I tried the easy_install command recommended by the site. This was the output I received:
Searching for rdflib==2.4.2
Reading http://pypi.python.org/simple/rdflib/
Reading http://rdflib.net/
Best match: rdflib 2.4.2
Downloading http://rdflib.net/rdflib-2.4.2.tar.gz
Processing rdflib-2.4.2.tar.gz
Running rdflib-2.4.2/setup.py -q bdist_egg --dist-dir /var/folders/Lr/Lrriod8lEEm63-sPBZf6XE+++TI/-Tmp-/easy_install-xa0EVw/rdflib-2.4.2/egg-dist-tmp-qvivjK
warning: no files found matching 'example.py'
zip_safe flag not set; analyzing archive contents...
No eggs found in /var/folders/Lr/Lrriod8lEEm63-sPBZf6XE+++TI/-Tmp-/easy_install-xa0EVw/rdflib-2.4.2/egg-dist-tmp-qvivjK (setup script problem?)
Uh, no egg found? I suppose that's somewhat appropriate, it is Easter today (darn Easter bunny!). I didn't think I could easily solve this problem, since there might be a problem with the setup script.
So, I tried downloading the tar file. Upon unpacking the file, there was a setup.py file. Great! I just need to run python setup.py install, right? Wrong.. here's the output:
Traceback (most recent call last):
File "setup.py", line 1, in
from setuptools import setup, find_packages
ImportError: No module named setuptools
OK, I checked the directory again, and noticed that there was an ez_setup.py file. Maybe this would do the trick? I ran python ez_setup.py, and there were no errors! Here was the output:
Downloading http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c9-py2.5.egg
Processing setuptools-0.6c9-py2.5.egg
Copying setuptools-0.6c9-py2.5.egg to /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages
Adding setuptools 0.6c9 to easy-install.pth file
Installing easy_install script to /Library/Frameworks/Python.framework/Versions/2.5/bin
Installing easy_install-2.5 script to /Library/Frameworks/Python.framework/Versions/2.5/bin
Installed /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c9-py2.5.egg
Processing dependencies for setuptools==0.6c9
Finished processing dependencies for setuptools==0.6c9
Looks like this solves the earlier error I received when running python setup.py install: the setuptools package was created! Great! I ran python setup.py install again, and rdflib was successfully installed...
with one caveat: the build files are located in build > lib.macosx-10.3-fat-2.5 (or some similar directory) > rdflib. Make sure to put this path in your PYTHONPATH. So far, I found one file in here that is necessary for running SPARQL queries, SPARQLParserc.so. It's not in the rdflib directory at the root of the rdflib-2.x.x directory!
Good luck!
First, I tried the easy_install command recommended by the site. This was the output I received:
Searching for rdflib==2.4.2
Reading http://pypi.python.org/simple/rdflib/
Reading http://rdflib.net/
Best match: rdflib 2.4.2
Downloading http://rdflib.net/rdflib-2.4.2.tar.gz
Processing rdflib-2.4.2.tar.gz
Running rdflib-2.4.2/setup.py -q bdist_egg --dist-dir /var/folders/Lr/Lrriod8lEEm63-sPBZf6XE+++TI/-Tmp-/easy_install-xa0EVw/rdflib-2.4.2/egg-dist-tmp-qvivjK
warning: no files found matching 'example.py'
zip_safe flag not set; analyzing archive contents...
No eggs found in /var/folders/Lr/Lrriod8lEEm63-sPBZf6XE+++TI/-Tmp-/easy_install-xa0EVw/rdflib-2.4.2/egg-dist-tmp-qvivjK (setup script problem?)
Uh, no egg found? I suppose that's somewhat appropriate, it is Easter today (darn Easter bunny!). I didn't think I could easily solve this problem, since there might be a problem with the setup script.
So, I tried downloading the tar file. Upon unpacking the file, there was a setup.py file. Great! I just need to run python setup.py install, right? Wrong.. here's the output:
Traceback (most recent call last):
File "setup.py", line 1, in
from setuptools import setup, find_packages
ImportError: No module named setuptools
OK, I checked the directory again, and noticed that there was an ez_setup.py file. Maybe this would do the trick? I ran python ez_setup.py, and there were no errors! Here was the output:
Downloading http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c9-py2.5.egg
Processing setuptools-0.6c9-py2.5.egg
Copying setuptools-0.6c9-py2.5.egg to /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages
Adding setuptools 0.6c9 to easy-install.pth file
Installing easy_install script to /Library/Frameworks/Python.framework/Versions/2.5/bin
Installing easy_install-2.5 script to /Library/Frameworks/Python.framework/Versions/2.5/bin
Installed /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c9-py2.5.egg
Processing dependencies for setuptools==0.6c9
Finished processing dependencies for setuptools==0.6c9
Looks like this solves the earlier error I received when running python setup.py install: the setuptools package was created! Great! I ran python setup.py install again, and rdflib was successfully installed...
with one caveat: the build files are located in build > lib.macosx-10.3-fat-2.5 (or some similar directory) > rdflib. Make sure to put this path in your PYTHONPATH. So far, I found one file in here that is necessary for running SPARQL queries, SPARQLParserc.so. It's not in the rdflib directory at the root of the rdflib-2.x.x directory!
Good luck!
Saturday, April 3, 2010
Bulk Upload Data to App Engine Dev DB
NOTE: these instructions are for the previous version of App Engine!
How to upload bulk data to App Engine Dev:
1. Create a loader file:
import datetime
import main
from google.appengine.ext import db
from google.appengine.tools import bulkloader
class ClothesLoader(bulkloader.Loader):
def __init__(self):
bulkloader.Loader.__init__(self, 'Clothes',
[('title', lambda x: x.decode('utf-8')),
('image', lambda x: x.decode('utf-8')),
('type', lambda x: x.decode('utf-8')),
('tag', lambda x: x.decode('utf-8'))
])
loaders = [ClothesLoader]
2. Create a CSV file with your data. Example:
Jeans, http://localhost:8080/images/jeans1.jpg, bottom, spring
3. In your app.yaml file, MAKE SURE you have the following lines:
handlers:
- url: /remote_api
script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py
4. Also make sure that your PYTHONPATH env var has the directory in which you saved your models. On a Mac:
export PYTHONPATH=$PYTHONPATH:<directory>
5. Finally, run the following command:
appcfg.py upload_data --config_file=<loader python file> --filename=<csv data file> --kind=<model name> --url=http://localhost:8083/remote_api <app directory>
Subscribe to:
Posts (Atom)