The inspect module is expecting "normal" .py files, which ActiveScript based
objects don't support.  It might be possible to tweak things so it does work
- last time I tried was many years ago now, and things may be easier to
trick now - see pyscript.py for any filename magic which does exist (eg, for
tracebacks etc)
 
Cheers,
 
Mark.
 
 
 -----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Marc-André Belzile
Sent: Saturday, 9 June 2007 5:26 AM
To: python-win32@python.org
Subject: [python-win32] inspect.getsource fails



Hi,
 
I get an IO error when executing some code based on the inspect module:
 
import inspect
 
def FunctionTest():
    x = 1
    y = 2
    return x+1
 
stringFunction = inspect.getsource(FunctionTest)
    
print stringFunction

 
# ERROR : Traceback (most recent call last):
#   File "<Script Block >", line 8, in <module>
#     stringFunction = inspect.getsource(FunctionTest)
#   File "C:\Python25\Lib\inspect.py", line 614, in getsource
#     lines, lnum = getsourcelines(object)
#   File "C:\Python25\Lib\inspect.py", line 603, in getsourcelines
#     lines, lnum = findsource(object)
#   File "C:\Python25\Lib\inspect.py", line 468, in findsource
#     raise IOError('could not get source code')
# IOError: could not get source code
#  - [line 8]

The script is invoked through the pywin ActiveX engine
IActiveScriptParse::ParseScriptText.
 
Any ideas what is going on?
 
thanks
 
-mab

<<attachment: winmail.dat>>

_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to