Skip to content

Instantly share code, notes, and snippets.

@erh
Created May 3, 2009 20:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erh/106149 to your computer and use it in GitHub Desktop.
Save erh/106149 to your computer and use it in GitHub Desktop.
from pymongo.connection import Connection , ConnectionFailure
import datetime
try:
connection = Connection("localhost", 27017)
except ConnectionFailure:
page_content = """<span class = "error">could not connect connect:besure that Mongo is running on localhost:27017</span>"""
except Exception, detail:
page_content = """<span class = "error">could not connect connect:besure that Mongo is running on localhost:27017</span>"""
print( "page_content:" + str( page_content ) )
print( "page_content:" + str( connection ) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment