<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
p
        {mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:Verdana;
        color:navy;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=blue>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'>Thank you very much, great repro, which points
to an IronPython bug which I opened on CodePlex (bug 940)<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'><a
href="http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython&WorkItemId=940">http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython&WorkItemId=940</a><o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'>in fact, the actual repro is even
simpler, no need to declare the TestClass either, simply import minidom and
exception happens.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'>>>> import sys<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'>>>>
sys.path.append(r"C:\Python24\Lib")<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'>>>> import xml.dom.minidom<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'>Traceback (most recent call last):<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'> File , line 0, in
<stdin>##8<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'> File , line 0, in __import__##5<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'> File
C:\Python24\Lib\xml\dom\minidom.py, line 462, in Initialize<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'>TypeError: Unable to cast object of type
'IronPython.Runtime.Types.OldClass' to type
'IronPython.Runtime.Types.DynamicType'.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Verdana><span style='font-size:
10.0pt;font-family:Verdana;color:navy'>Martin<o:p></o:p></span></font></p>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
users-bounces@lists.ironpython.com [mailto:users-bounces@lists.ironpython.com] <b><span
style='font-weight:bold'>On Behalf Of </span></b>Mike Raath<br>
<b><span style='font-weight:bold'>Sent:</span></b> Friday, July 14, 2006 12:18
AM<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">Discussion
of IronPython</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [IronPython] Unable
to cast object of type 'IronPython.Runtime.Types.OldClass' to type
'IronPython.Runtime.Types.DynamicType'</span></font><o:p></o:p></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>OK - I've broken it down
to its simplest form. It looks like there's a problem importing the minidom
class.<br>
<br>
If you create a module TestModule.py containing the following code:<br>
<br>
Python Code<br>
==========<br>
import xml.dom.minidom<br>
<br>
class TestClass:<br>
pass<br>
<br>
<br>
and then try to import this class you will see this error.<br>
<br>
My C# code is as follows:<br>
====================<br>
PythonEngine
engine = new PythonEngine(); <br>
<br>
engine.AddToPath("C:\\Python24\\lib");<br>
engine.AddToPath("C:\\Temp\\IronPythonTest\\IronPythonTest\\Python\\");<br>
engine.Execute("from TestModule import TestClass"); <br>
<br>
<br>
Mike<o:p></o:p></span></font></p>
<div>
<p class=MsoNormal><span class=gmailquote><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>On 7/13/06, <st1:PersonName w:st="on"><b><span
style='font-weight:bold'>Martin Maly</span></b></st1:PersonName> <<a
href="mailto:Martin.Maly@microsoft.com">Martin.Maly@microsoft.com</a>>
wrote:</span></font></span><o:p></o:p></p>
<div>
<div link=blue vlink=purple>
<div>
<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>However, that said, in Beta 9, the OldClass is no longer a
DynamicType, which explains the exception itself. To find out what you need to
change in your code is something that we'll need more info for.</span></font><o:p></o:p></p>
<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'> </span></font><o:p></o:p></p>
<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>For example, the exception can come from anywhere in the
Module body (during import, the module body gets executed – unless the
module has been already imported). Since I don't get exception when executing
"from Module import Class", I suspect that this is what may be the
case. The call stack for the exception could help find out what line in your
module code is throwing.</span></font><o:p></o:p></p>
<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'> </span></font><o:p></o:p></p>
<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>M.</span></font><o:p></o:p></p>
<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'> </span></font><o:p></o:p></p>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center>
</span></font></div>
<p><b><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma;
font-weight:bold'>From:</span></font></b><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'> <a
href="mailto:users-bounces@lists.ironpython.com" target="_blank"
title="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a>
[mailto: <a href="mailto:users-bounces@lists.ironpython.com" target="_blank"
title="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a>]
<b><span style='font-weight:bold'>On Behalf Of </span></b><st1:PersonName
w:st="on">Martin Maly</st1:PersonName><br>
<b><span style='font-weight:bold'>Sent:</span></b> Thursday, July 13, 2006 8:09
AM<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">Discussion
of IronPython</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [IronPython] Unable
to cast object of type 'IronPython.Runtime.Types.OldClass' to type
'IronPython.Runtime.Types.DynamicType'</span></font><o:p></o:p></p>
</div>
</div>
<div><span id="q_10c687b69844715c_1">
<p><font size=3 face="Times New Roman"><span style='font-size:12.0pt'> <o:p></o:p></span></font></p>
<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>To help you, we will need more information about your use of
the Python Engine. The simple case of executing "from Module import
Class" does work so we need to know more to find out what the problem may
be.</span></font><o:p></o:p></p>
<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'> </span></font><o:p></o:p></p>
<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>Thanks</span></font><o:p></o:p></p>
<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>Martin</span></font><o:p></o:p></p>
<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'> </span></font><o:p></o:p></p>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center>
</span></font></div>
<p><b><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma;
font-weight:bold'>From:</span></font></b><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'> <a
href="mailto:users-bounces@lists.ironpython.com" target="_blank"
title="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a>
[mailto: <a href="mailto:users-bounces@lists.ironpython.com" target="_blank"
title="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a>]
<b><span style='font-weight:bold'>On Behalf Of </span></b>Mike Raath<br>
<b><span style='font-weight:bold'>Sent:</span></b> Thursday, July 13, 2006 1:41
AM<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">Discussion
of IronPython</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> [IronPython] Unable to
cast object of type 'IronPython.Runtime.Types.OldClass' to type
'IronPython.Runtime.Types.DynamicType'</span></font><o:p></o:p></p>
</div>
<p><font size=3 face="Times New Roman"><span style='font-size:12.0pt'> <o:p></o:p></span></font></p>
<p><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>Hi<br>
<br>
Having tried to switch over to beta 9, and changing my generic
Evaluate<T> references to EvaluateAs<T>, I get a runtime error on
an import statement which works under beta 8. The exception is as is detailed
in the message above, and is from a statement like <br>
engine.Execute("from Module import Class);<br>
<br>
The Module and Class definitions are custom - and as i say this statement works
under beta 8.<br>
<br>
Do you require more information or do I need to make a further change to my
code to get it to work? <br>
<br>
Thanks,<br>
Mike<o:p></o:p></span></font></p>
</div>
</div>
</div>
</span>
<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><br>
_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@lists.ironpython.com">users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com"
target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><o:p></o:p></span></font></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
</body>
</html>