I wrote an simple py named "test.py" to demo this Issue
def hello():
print "hello world!"
and I use Tools\Scripts\pyc.py it compile it into DLLs
C:\IronPython-2.7.3>ipy.exe Tools\Scripts\pyc.py /target:dll /out:DLLs/test D:\test.py
Input Files:
D:\test.py
Output:
DLLs/test.dll
Target:
Dll
Platform:
ILOnly
Machine:
I386
Compiling...
Saved to test
I write another script to to import use it by clr.AddReference
import clr
clr.AddReference("test")
import test
test.hello()
It was just Fine in normal mode
C:\IronPython-2.7.3>ipy.exe test2.py
hello world!
But when I use pdb to debug test2.py,will got following error message
C:\IronPython-2.7.3>ipy.exe -X:Frames -X:Tracing -m pdb test2.py
Unhandled exception:
Traceback (most recent call last):
File "C:\IronPython-2.7.3\Lib\runpy.py", line 170, in run_module
File "C:\IronPython-2.7.3\Lib\runpy.py", line 101, in _get_module_details
File "C:\IronPython-2.7.3\Lib\pkgutil.py", line 456, in get_loader
File "C:\IronPython-2.7.3\Lib\pkgutil.py", line 467, in find_loader
TypeError: find_module() takes exactly 2 arguments (1 given)
after some source tracing,I change the pkgutil.py
diff --git a/Lib/pkgutil.py b/Lib/pkgutil.py
index 322bbdf..3509b46 100644
--- a/Lib/pkgutil.py
+++ b/Lib/pkgutil.py
@@ -464,7 +464,7 @@ def find_loader(fullname):
platform-specific special import locations such as the Windows registry.
"""
for importer in iter_importers(fullname):
- loader = importer.find_module(fullname)
+ loader = importer.find_module(fullname,[])
if loader is not None:
return loader
Now, I can debug this code.
C:\IronPython-2.7.3>ipy.exe -X:Frames -X:Tracing -m pdb test2.py
> c:\ironpython-2.7.3\test2.py(1)<module>()
-> import clr
(Pdb) c
hello world!