[IronPython] profiling in IronPython error

Pablo Dalmazzo pablodalma93 at hotmail.com
Sat Aug 14 14:33:40 CEST 2010

I followed your recommendation and now I get this,

'module' object has no attribute 'setprofile'


I used the profile module from an IronPython 2.6 installation. I also found this in the web,

In other
 words, another Python implementation like IronPython is within its own 
right not to implement these functions. As a matter of fact:
IronPython 1.1 (1.1) on .NET 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
>>> sys.settrace(f)
Traceback (most recent call last):
NotImplementedError: sys.settrace is not yet supported by IronPython
>>> sys.setprofile(f)
Traceback (most recent call last):
AttributeError: 'module' object has no attribute 'setprofile'

is that implemented / going to be implemented in another IronPython version or should I 
use another profiler  with IronPython? If so, could you recommend me one?


From: dinov at microsoft.com
To: users at lists.ironpython.com
Date: Thu, 12 Aug 2010 21:05:00 +0000
Subject: Re: [IronPython] profiling in IronPython error

In ASP.NET I’m guessing we don’t ever make a module called __main__.  From the command line when you do “ipy foo.py” foo.py is actually called __main__ and
 there’s no foo module.  But if you import foo from an interactive session then it’s named foo.
You could do something like:
import sys
sys.modules[‘__main__’] = foo
where foo is whatever the “main” module is.  Or if this is your code you could change it to not try to import __main__ or make it try main and then try something

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com]
On Behalf Of Pablo Dalmazzo

Sent: Thursday, August 12, 2010 7:58 AM

To: IronPython Mailing list

Subject: [IronPython] profiling in IronPython error

Hi guys,

Im trying to run this test I had in cPython in IronPython 2.6 in asp.net. 

   from profile import *

    class Prueba(object):                                                         


        def probarvelocidad():

            lista = ['a','b','c']

            for x in lista: pass


It doesnt work, i get this 

Mensaje de error del analizador: No module named __main__

Error de código fuente:  (Line 454, import __main__ )

Línea 452:

Línea 453:    def run(self, cmd):

  Línea 454:        import __main__

Any ideas? can I give any more useful information to know which the problem is?


Users mailing list
Users at lists.ironpython.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100814/2fb91d9d/attachment.html>

More information about the Ironpython-users mailing list