This script has been working fine, however now when I go to execute it, it fails to compile with:
File "/Users/camerongordon/Desktop/Python Scripts/hello.py", line 12
def ConnectToDatabase():
^
IndentationError: expected an indented block
Here is the script:
import tornado.ioloop
import tornado.web
from tornado.httpclient import AsyncHTTPClient
from tornado import gen
from tornado.options import define, options
from apscheduler.schedulers.tornado import TornadoScheduler
from torndb import Connection
class MainHandler(tornado.web.RequestHandler):
def get(self):
def ConnectToDatabase():
db = Connection("127.0.0.1", 'helloworld', user='root', password='')
return db
application = tornado.web.Application
([
(r"/", MainHandler),
])
def ProcessQueue:
def main():
# http://stackoverflow.com/questions/29316173/apscheduler-run-async-function-in-tornado-python
# https://github.com/teriyakichild/example-scheduler/blob/master/example_scheduler/__init__.py
application.listen(8888)
db = ConnectToDatabase()
scheduler = TornadoScheduler()
scheduler.add_job(ProcessQueue, 'interval', name='tick-interval-3-seconds', seconds=4, timezone='America/Chicago')
scheduler.start()
tornado.ioloop.IOLoop.current().start()
if __name__ == "__main__":
main();
What is going on? Everything looks syntactically correct and indented properly.