[PATCH] Re: Import cProfile module before falling back to profile

Leif Walsh leif.walsh at gmail.com
Mon Dec 6 17:28:47 GMT 2010


This is a common idiom for cProfile and cPickle and others, the interfaces
are meant to be identical and it should not be a problem.
On Dec 6, 2010 12:24 PM, "Nicolas Sebrecht" <nicolas.s-dev at laposte.net>
wrote:
> On Mon, Dec 06, 2010 at 01:19:31PM +0100, Sebastian Spaeth wrote:
>
>> diff --git a/offlineimap/threadutil.py b/offlineimap/threadutil.py
>> index b516f68..c65700e 100644
>> --- a/offlineimap/threadutil.py
>> +++ b/offlineimap/threadutil.py
>> @@ -148,7 +148,10 @@ class ExitNotifyThread(Thread):
>> if not profiledir: # normal case
>> Thread.run(self)
>> else:
>> - import profile
>> + try:
>> + import cProfile as profile
>> + except ImportError:
>> + import profile
>
> How do we know which library is currently used?
>
> --
> Nicolas Sebrecht
>
> _______________________________________________
> OfflineIMAP-project mailing list
> OfflineIMAP-project at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/offlineimap-project
>
> OfflineIMAP homepage: http://software.complete.org/offlineimap
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/offlineimap-project/attachments/20101206/b6eb6d5a/attachment-0001.html>


More information about the OfflineIMAP-project mailing list