In the context of IIS you run Python as a AX-Scripting-Language.
The same problem is happend with WSH or IE.

----- file: test.pys ---------
import profile
def main(): pass
print __name__; print dir()
profile.run("print __name__; print dir()")
----- file: test.pys ---------

When you start test.pys on the prompt like CSCRIPT TEST.PYS
you get this back:

Microsoft (R) Windows Script Host, Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. Alle Rechte vorbehalten.

 __ax_main__
['WSH', 'WScript', '__builtins__', '__doc__', '__name__', 'ax', 'main', 'profile']
__main__
['__builtins__', '__doc__', '__name__']
         6 function calls in 0.069 CPU seconds

   Ordered by: standard name

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.001    0.001    0.007    0.007 <string>:1(?)
        4    0.006    0.002    0.006    0.002 framework.py:46(write)
        1    0.062    0.062    0.069    0.069 profile:0(print __name__; print dir())
        0    0.000             0.000          profile:0(profiler)

As you see, the profiler use a quite different scope and there is no
easy way to fix it.

Markus


----- Original Message -----
From: "K�ri Har�arson" <[EMAIL PROTECTED]>
To: "'Markus Daniel'" <[EMAIL PROTECTED]>
Sent: Friday, October 12, 2001 6:07 PM
Subject: RE: Using the python profiler from an ASP Python page


Oops, the code does say "profile" and
I quoted it incorrectly.  The error message
is accurate though.

Best to you,

Kari


> -----Original Message-----
> From: Markus Daniel [mailto:[EMAIL PROTECTED]]
> Sent: 12. okt�ber 2001 15:24
> To: K�ri Har�arson
> Subject: Re: Using the python profiler from an ASP Python page
>
>
> Hello,
>
> I posted this message not in to the list, because I am not sure to
> provide the correct tip.
>
> I belive the import-statement already fails. There is no module
> "profiler". Could it be you mean "profile" ?
>
> Markus
>
>
> ----- Original Message -----
> From: "K�ri Har�arson" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, October 12, 2001 2:59 PM
> Subject: Using the python profiler from an ASP Python page
>
>
> > Hello all,
> >
> >
> > When I try the following on an .ASP page :
> >
> > -----------------------
> > import profiler
> >
> > def main():
> > Response.write("Hi")
> >
> > profiler.run("main()","profile.log")
> > ----------------------------------------
> > The profiler claims that variable "main" is not declared.
> > What gives ?
> >
> > Thank you,  Kari
> > _______________________________________________
> > ActivePython mailing list
> > [EMAIL PROTECTED]
> > http://listserv.ActiveState.com/mailman/listinfo/activepython
> >
>


_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activepython

Reply via email to