I'm working on creating an app that a user can input a paragraph of text and I run spellcheck on the paragraph. I've implemented this easily enough in a local document just using python by opening the file 'words.txt' which contains my dictionary. I'm trying to figure out how to open a word list for implementing my spell check.
My first attempt has been to place it as a static file in my directory and do a fetch on the file, but I keep getting an error.
Here are my files:
app.yaml:
application: *******
version: 1
runtime: python
api_version: 1
handlers:
- url: /(.*\.txt)
mime_type: text/plain
static_files: static/\1
upload: static/(.*\.txt)
- url: /.*
script: helloworld.py
Excerpts from helloworld.py
import os
from google.appengine.ext.webapp import template
import cgi
import datetime
import urllib
import wsgiref.handlers
from google.appengine.api import urlfetch
from google.appengine.ext import db
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
....
result=urlfetch.fetch(os.path.join(os.path.dirname(__file__),'words.txt'))
words=set(result.splitlines())
What is wrong? I keep getting an error.