[Zope3-dev] Re: Why is the testrunner running with the --profile option ?
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.0 + Lib/hotshot/stats.py 2006-04-21 18:39:17.691461512 + +@@ -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 ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
Re: [Zope3-dev] Re: Why is the testrunner running with the --profile option ?
Michael Haubenwallner wrote: Here is the patch that made it break: +--- Lib/hotshot/stats.py~2001-10-15 22:18:53.0 + Lib/hotshot/stats.py2006-04-21 18:39:17.691461512 + +@@ -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 Wow, that's pretty evil. Who's the appropriate Ubuntu person to take this up with? cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
Re: [Zope3-dev] Re: Why is the testrunner running with the --profile option ?
Chris Withers wrote: Michael Haubenwallner wrote: Here is the patch that made it break: +--- Lib/hotshot/stats.py~2001-10-15 22:18:53.0 + Lib/hotshot/stats.py2006-04-21 18:39:17.691461512 + [...] Wow, that's pretty evil. Who's the appropriate Ubuntu person to take this up with? Matthias Klose, but the best way to report this would be via: https://bugs.launchpad.net/ubuntu/+source/python2.4/+filebug -Andrew. ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
[Zope3-dev] Re: Why is the testrunner running with the --profile option ?
Michael Haubenwallner wrote: Just for the record, the problem is created by the ubuntu diffs that where automatically installed with the python2.4-minimal package That is one of the more repugnant things I've seen a distribution force on their users in quite some time. I intent to complain to the Ubuntu team. You are completely right and there is no problem with python installed from source. These sorts of games are one of the reasons I (and many others) strongly prefer working with Pythons that we built ourselves. Thanks for the good work running this to ground. -- Benji York Senior Software Engineer Zope Corporation ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
Re: [Zope3-dev] Re: Why is the testrunner running with the --profile option ?
Andrew Bennetts wrote: Chris Withers wrote: Michael Haubenwallner wrote: Here is the patch that made it break: +--- Lib/hotshot/stats.py~2001-10-15 22:18:53.0 + Lib/hotshot/stats.py2006-04-21 18:39:17.691461512 + [...] Wow, that's pretty evil. Who's the appropriate Ubuntu person to take this up with? Matthias Klose, but the best way to report this would be via: https://bugs.launchpad.net/ubuntu/+source/python2.4/+filebug done: https://bugs.launchpad.net/ubuntu/+source/python2.4/+bug/88960 cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
[Zope3-dev] Re: Why is the testrunner running with the --profile option ?
Benji York schrieb: Michael Haubenwallner wrote: Why is the testrunner running with the --profile option ? I did not set it. I understand that profiling should be disabled if hotshot cannot be imported. Running (from a svn checkout) python test.py -s zope.anypackage Works for me. ImportError: No module named profile please install the python2.4-profiler package zope.testing never imports profile. It uses hotshot, but that import is protected by a try/except because some distributions don't include hotshot. Perhaps we could help more if you included the full traceback of the above exception. It is like Marius Gedminas said earlier in his response: just install python2.4-profiler package and it works. The problem (again) was using 'test.py' with the system python; hotshot was installed but the profiler module missing. 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. Thanks anyway Michael -- http://www.zope.org/Members/d2m http://planetzope.org/ ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
Re: [Zope3-dev] Re: Why is the testrunner running with the --profile option ?
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. -- Benji York Senior Software Engineer Zope Corporation ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com