<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7654.12">
<TITLE>Dropin.cache errors after clean install of twisted-8.2.0</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=2 FACE="Arial">I recently installed python-2.6.1 and then twisted-8.2.0 (outside of the python tree). One of my users is complaining that when he uses trial to test some twisted programs, although his test passes, he has to stare at a stack trace like this which mentions dropin.cache.new failing to be written:</FONT></P>
<P><FONT SIZE=2 FACE="Arial">$ cat foo.py</FONT>
<BR><FONT SIZE=2 FACE="Arial">#!/sw/external/python-2.6.1/bin/python</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">from twisted.trial import unittest</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">class MyTestClass(unittest.TestCase):</FONT>
<BR><FONT SIZE=2 FACE="Arial"> def test_foobar(self):</FONT>
<BR><FONT SIZE=2 FACE="Arial"> print 'hello, world!'</FONT>
<BR><FONT SIZE=2 FACE="Arial"> self.failUnless(1 == 1)</FONT>
<BR><FONT SIZE=2 FACE="Arial">$ /sw/external/twisted-8.2.0/bin/trial ./foo.py</FONT>
<BR><FONT SIZE=2 FACE="Arial">/sw/external/twisted-8.2.0/lib/python/twisted/persisted/sob.py:12: DeprecationWarning: the md5 module is deprecated; use hashlib instead</FONT></P>
<P><FONT SIZE=2 FACE="Arial"> import os, md5, sys</FONT>
<BR><FONT SIZE=2 FACE="Arial">/sw/external/twisted-8.2.0/lib/python/twisted/python/filepath.py:12: DeprecationWarning: the sha module is deprecated; use the hashlib module instead</FONT></P>
<P><FONT SIZE=2 FACE="Arial"> import sha</FONT>
<BR><FONT SIZE=2 FACE="Arial">/sw/external/twisted-8.2.0/lib/python/twisted/web/microdom.py:181: SyntaxWarning: assertion is always true, perhaps remove parentheses?</FONT></P>
<P><FONT SIZE=2 FACE="Arial"> assert (oldChild.parentNode is self,</FONT>
<BR><FONT SIZE=2 FACE="Arial">Traceback (most recent call last):</FONT>
<BR><FONT SIZE=2 FACE="Arial"> File "/sw/external/twisted-8.2.0/lib/python/twisted/python/usage.py", line 241, in parseOptions</FONT>
<BR><FONT SIZE=2 FACE="Arial"> self.postOptions()</FONT>
<BR><FONT SIZE=2 FACE="Arial"> File "/sw/external/twisted-8.2.0/lib/python/twisted/scripts/trial.py", line 293, in postOptions</FONT>
<BR><FONT SIZE=2 FACE="Arial"> self['reporter'] = self._loadReporterByName(self['reporter'])</FONT>
<BR><FONT SIZE=2 FACE="Arial"> File "/sw/external/twisted-8.2.0/lib/python/twisted/scripts/trial.py", line 279, in _loadReporterByName</FONT>
<BR><FONT SIZE=2 FACE="Arial"> for p in plugin.getPlugins(itrial.IReporter):</FONT>
<BR><FONT SIZE=2 FACE="Arial"> File "/sw/external/twisted-8.2.0/lib/python/twisted/plugin.py", line 200, in getPlugins</FONT>
<BR><FONT SIZE=2 FACE="Arial"> allDropins = getCache(package)</FONT>
<BR><FONT SIZE=2 FACE="Arial">--- <exception caught here> ---</FONT>
<BR><FONT SIZE=2 FACE="Arial"> File "/sw/external/twisted-8.2.0/lib/python/twisted/plugin.py", line 179, in getCache</FONT>
<BR><FONT SIZE=2 FACE="Arial"> dropinPath.setContent(pickle.dumps(dropinDotCache))</FONT>
<BR><FONT SIZE=2 FACE="Arial"> File "/sw/external/twisted-8.2.0/lib/python/twisted/python/filepath.py", line 623, in setContent</FONT>
<BR><FONT SIZE=2 FACE="Arial"> f = sib.open('w')</FONT>
<BR><FONT SIZE=2 FACE="Arial"> File "/sw/external/twisted-8.2.0/lib/python/twisted/python/filepath.py", line 433, in open</FONT>
<BR><FONT SIZE=2 FACE="Arial"> return open(self.path, mode+'b')</FONT>
<BR><FONT SIZE=2 FACE="Arial">exceptions.IOError: [Errno 30] Read-only file system: '/sw/external/twisted-8.2.0/lib/python/twisted/plugins/dropin.cache.new'</FONT></P>
<P><FONT SIZE=2 FACE="Arial">foo</FONT>
<BR><FONT SIZE=2 FACE="Arial"> MyTestClass</FONT>
<BR><FONT SIZE=2 FACE="Arial"> test_foobar ... hello, world!</FONT>
<BR><FONT SIZE=2 FACE="Arial"> [OK]</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">-------------------------------------------------------------------------------</FONT>
<BR><FONT SIZE=2 FACE="Arial">Ran 1 tests in 0.023s</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">PASSED (successes=1)</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">I would consider this to be an install bug. Evidently, trial uses plugins, which upon reading </FONT><A HREF="http://twistedmatrix.com/projects/core/documentation/howto/plugin.html#auto3"><U><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">http://twistedmatrix.com/projects/core/documentation/howto/plugin.html#auto3</FONT></U></A><FONT SIZE=2 FACE="Arial"> I find that plugins need up-to-date dropin.cache files to be built, or else they'll be built dynamically; the latter step fails in my case due to my site-wide install being on a read-only directory. The docs say "</FONT><FONT FACE="Arial">when installing or removing software which provides Twisted plugins, the site administrator should be sure the cache is regenerated</FONT><FONT SIZE=2 FACE="Arial">"; however all I did was install twisted itself, not any specific plugins. All I did to install twisted was 'python setup.py install --home=...' and at no later point did I ever add new plugins to it. Why can't the install take care of initial dropin.cache generation for me?</FONT></P>
<P><FONT SIZE=2 FACE="Arial">I see a related issue </FONT><A HREF="http://twistedmatrix.com/trac/ticket/2409"><U><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">http://twistedmatrix.com/trac/ticket/2409</FONT></U></A><FONT SIZE=2 FACE="Arial">.</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Regardless of whether ticket 2409 goes anywhere, should I raise an issue that the install should really take care of initial dropin.cache generation, much like python install takes care of std lib .py->.pyc generation?</FONT></P>
<P><FONT SIZE=2 FACE="Arial">Thanks.</FONT>
</P>
</BODY>
</HTML>