[Twisted-Python] dropin.cache?

Phil Christensen phil at bubblehouse.org
Tue Jul 10 16:00:01 EDT 2007


So, I've been making great strides with my plugin system, using  
twisted's plugin support, but there's just one small issue I'm having  
that I can't seem to figure out.

Traceback (most recent call last):
   File "/Users/phil/Workspace/modu/modu/web/wsgi.py", line 16, in  
handler
     application = app.get_application(env)
   File "/Users/phil/Workspace/modu/modu/web/app.py", line 34, in  
get_application
     _load_plugins(env)
   File "/Users/phil/Workspace/modu/modu/web/app.py", line 53, in  
_load_plugins
     for site_plugin in plugin.getPlugins(ISite, modu.plugins):
   File "/Users/phil/Workspace/Twisted/twisted/plugin.py", line 186,  
in getPlugins
     allDropins = getCache(package)
--- <exception caught here> ---
   File "/Users/phil/Workspace/Twisted/twisted/plugin.py", line 165,  
in getCache
     dropinPath.setContent(pickle.dumps(dropinDotCache))
   File "/Users/phil/Workspace/Twisted/twisted/python/filepath.py",  
line 525, in setContent
     sib.open('w').write(content)
   File "/Users/phil/Workspace/Twisted/twisted/python/filepath.py",  
line 369, in open
     return open(self.path, mode+'b')
exceptions.IOError: [Errno 13] Permission denied: '/Users/phil/ 
Workspace/modu/examples/basic/modu/plugins/dropin.cache.new'


The issue is that my app doesn't have write access to the various  
plugin directories by default, as it runs as a restricted user. This  
is basically a configuration detail that my users will have to take  
care of, but I'd like to  be able to catch this error and provide a  
nicer message, or at least not have my logfile filled up with stack  
traces.

The problem is that putting a try/catch around getPlugins doesn't  
work, or doesn't appear to. I've looked at the code in getPlugins,  
and I can't figure out why the exception isn't being caught. Since  
I'm not actually using the reactor, I would assume there's no  
deferred trickery that needs to be done, so I'm at a bit of a loss.

Any help in this matter would be appreciated...

-phil




More information about the Twisted-Python mailing list