[Zope3-dev] Re: Why is the testrunner running with the --profile option ?

Michael Haubenwallner michael at d2m.at
Thu Mar 1 05:19:44 EST 2007


Benji York wrote:
> Michael Haubenwallner wrote:
>> It is like Marius Gedminas said earlier in his response: just install 
>> python2.4-profiler package and it works.
> 
> I'm glad that solved your particular problem.  zope.testing is supposed 
> to work without hotshot (and therefore its dependencies like profile), 
> so I'd like to figure out why it's not working correctly.
> 
>> hotshot.stats throws the ImportException and then exits; there is no 
>> traceback available. I think, the only way to catch this case is 
>> trying to import profile in testrunner itself before importing 
>> hotshot.stats.
> 
> This is what has me confused; the only imports of hotshot and 
> hotshot.stats are protected by try/excepts.

You are completely right and there is no problem with python installed 
from source.

Just for the record, the problem is created by the ubuntu diffs that 
where automatically installed with the python2.4-minimal package
http://archive.ubuntu.com/ubuntu/pool/main/p/python2.4/python2.4_2.4.3-0ubuntu6.diff.gz

Here is the patch that made it break:
+--- Lib/hotshot/stats.py~	2001-10-15 22:18:53.000000000 +0000
++++ Lib/hotshot/stats.py	2006-04-21 18:39:17.691461512 +0000
+@@ -1,7 +1,14 @@
+ """Statistics analyzer for HotShot."""
+
+-import profile
+-import pstats
++try:
++    import profile
++    import pstats
++except ImportError, msg:
++    import sys
++    sys.stderr.write('ImportError: %s\n' % str(msg))
++    sys.stderr.write('please install the python%s-profiler package\n'
++                     % sys.version[:3])
++    sys.exit(1)
+
+ import hotshot.log
+

Hth anyone facing the same problem,
Michael

-- 
http://zope.org/Members/d2m
http://planetzope.org



More information about the Zope3-dev mailing list