Skip to content

Instantly share code, notes, and snippets.

@clemesha
Created June 5, 2009 05:15
Show Gist options
  • Save clemesha/124084 to your computer and use it in GitHub Desktop.
Save clemesha/124084 to your computer and use it in GitHub Desktop.
"""
When I run this script with:
twistd -ny logobservermemfail.py
On OSX, using Twisted 8.2.0, Python 2.5, i see this error:
Python(12631) malloc: *** mmap(size=1275076608) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
"""
from twisted.web import static, server
from twisted.application import service, internet
from twisted.python import log, logfile
class MyLogObserver(object):
def emit(self, eventDict):
print eventDict
root = static.File(".")
application = service.Application("App")
mlo = MyLogObserver()
application.setComponent(log.ILogObserver, mlo.emit)
site = server.Site(root)
service = internet.TCPServer(8888, site)
service.setServiceParent(application)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment