Re pyd:s playing tricks..<br><br>In this case it's not any pyd:s that is playing tricks but C:\Python24\Lib\xml\__init__.py :<br><br><span style="font-family: courier new,monospace;">_MINIMUM_XMLPLUS_VERSION = (0, 8, 4)</span>
<br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">try:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; import _xmlplus</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">except ImportError:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; pass</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">else:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; try:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v = _xmlplus.version_info</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; except AttributeError:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # _xmlplus is too old; ignore it
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pass</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
&nbsp;&nbsp;&nbsp; else:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if v &gt;= _MINIMUM_XMLPLUS_VERSION:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; import sys</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sys.modules[__name__] = _xmlplus</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; del v</span><br style="font-family: courier new,monospace;">
<br><br><br>(PyXML installs itself as _xmplus)<br><div><span class="gmail_quote"><br>On 5/19/06, <b class="gmail_sendername">Dino Viehland</b> &lt;<a href="mailto:dinov@exchange.microsoft.com">dinov@exchange.microsoft.com
</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>









<div link="blue" vlink="blue" lang="EN-US">

<div>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">This is probably really tough to do –
in order to know the PYD is playing tricks we'd need to support using the
PYD, and then it's not a problem anymore. &nbsp;I'll open a bug on this
anyway to see if we can make the experience better, but I have no idea what sort
of time frame we'd be able to do this in (another option for us would be
to create an xpath wrapper around System.Xml.XPath which looks like pyxml, but
it'd not solve any larger problems around PYDs in general).</span></font></p></div><div><span class="q">

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<div>

<p><font color="navy" face="Bookman Old Style" size="1"><span style="font-size: 8pt; color: navy;"><a href="http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
Do
you want to help develop Dynamic languages on CLR?</a> </span></font><font color="white" face="Bookman Old Style" size="1"><span style="font-size: 1pt; color: white;">(<a href="http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038</a>)</span></font><font face="Bookman Old Style" size="1"><span style="font-size: 8pt;"></span></font></p>

</div>

</span></div><div><div>

<div style="text-align: center;" align="center"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">

<hr align="center" size="2" width="100%">

</span></font></div>

<p><b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">From:</span></font></b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma;">
<a href="mailto:users-bounces@lists.ironpython.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">users-bounces@lists.ironpython.com</a> [mailto:<a href="mailto:users-bounces@lists.ironpython.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
users-bounces@lists.ironpython.com</a>] <b><span style="font-weight: bold;">On Behalf Of </span></b>Greg Lee<br>
<b><span style="font-weight: bold;">Sent:</span></b> Friday, May 19, 2006 10:18
AM</span></font></p></div><div><span class="e" id="q_10b4daecf13af980_3"><font face="Tahoma" size="2"><br>
<b><span style="font-weight: bold;">To:</span></b> Discussion of IronPython<br>
<b><span style="font-weight: bold;">Subject:</span></b> Re: [IronPython] from xml
import xpath</font></span></div><div><p></p>

</div></div><div><span class="e" id="q_10b4daecf13af980_5">

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&nbsp;</span></font></p>

<div>

<p><font color="blue" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: blue;">Is a better diagnostic message
possible?&nbsp; This would let us distinguish a pyd problem from &quot;playing
tricks with paths&quot;, and presumably there might be some value in fixing any
problems in the latter.</span></font></p>

</div>

<blockquote style="margin-top: 5pt; margin-right: 0in; margin-bottom: 5pt;">

<p style="margin-bottom: 12pt;"><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma;">-----Original Message-----<br>
<b><span style="font-weight: bold;">From:</span></b>
<a href="mailto:users-bounces@lists.ironpython.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">users-bounces@lists.ironpython.com</a> [mailto:<a href="mailto:users-bounces@lists.ironpython.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
users-bounces@lists.ironpython.com</a>]<b><span style="font-weight: bold;">On Behalf Of </span></b>Dino Viehland<br>
<b><span style="font-weight: bold;">Sent:</span></b> Wednesday, May 17, 2006
11:50 AM<br>
<b><span style="font-weight: bold;">To:</span></b> Discussion of IronPython<br>
<b><span style="font-weight: bold;">Subject:</span></b> Re: [IronPython] from xml
import xpath</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">You're right, I did miss
that…&nbsp; Looking at this page: <a href="http://pyxml.sourceforge.net/topics/howto/section-install.html" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://pyxml.sourceforge.net/topics/howto/section-install.html
</a>&nbsp;
It would seem that you may be right about the Pyd's (it at least requires
a C compiler, making that likely – and almost guaranteeing it won't
work w/ IronPython).</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Unfortunately we don't support
PYD's currently (and aren't likely to soon) so most likely this
won't currently work. If you absolutely need XPath support in the mean
time I'd suggest using .NET's XMLPath (and if you need to work on
both you could make a thin wrapper over either PyXml for CPython and
.NET's XPath support).&nbsp; For example:</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">import clr</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">clr.AddReference('System.Xml')</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">import System.Xml.XPath as XPath</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">xpathDoc =
XPath.XPathDocument('file://foo.txt')</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<div>

<p><font color="navy" face="Bookman Old Style" size="1"><span style="font-size: 8pt; color: navy;"><a href="http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
Do
you want to help develop Dynamic languages on CLR?</a> </span></font><font color="white" face="Bookman Old Style" size="1"><span style="font-size: 1pt; color: white;">(<a href="http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038</a>)</span></font><font face="Bookman Old Style" size="1"><span style="font-size: 8pt;"></span></font></p>

</div>

<div>

<div style="text-align: center;" align="center"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">

<hr align="center" size="2" width="100%">

</span></font></div>

<p><b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">From:</span></font></b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma;">
<a href="mailto:users-bounces@lists.ironpython.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">users-bounces@lists.ironpython.com</a> [mailto:<a href="mailto:users-bounces@lists.ironpython.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
users-bounces@lists.ironpython.com</a>] <b><span style="font-weight: bold;">On Behalf Of </span></b>Simon Dahlbacka<br>
<b><span style="font-weight: bold;">Sent:</span></b> Wednesday, May 17, 2006
11:41 AM<br>
<b><span style="font-weight: bold;">To:</span></b> Discussion of IronPython<br>
<b><span style="font-weight: bold;">Subject:</span></b> Re: [IronPython] from xml
import xpath</span></font></p>

</div>

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&nbsp;</span></font></p>

<p style="margin-bottom: 12pt;"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">Dino, you seemed to have
missed the part about pyxml..<br>
<br>
It works in cpython with pyxml installed. However, pyxml is playing tricks with
paths etc, and there might even be pyd:s involved..<br>
<br>
C:\Python24&gt;python.exe <br>
Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32<br>
Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or
&quot;license&quot; for more information.<br>
&gt;&gt;&gt; import xml <br>
&gt;&gt;&gt; xml.__file__<br>
'C:\\Python24\\lib\\site-packages\\_xmlplus\\__init__.pyc'<br>
&gt;&gt;&gt; from xml import xpath<br>
&gt;&gt;&gt;</span></font></p>

<div>

<p><span><font face="Times New Roman" size="3"><span style="font-size: 12pt;">On 5/17/06, <b><span style="font-weight: bold;">Dino
Viehland</span></b> &lt;<a href="mailto:dinov@exchange.microsoft.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">dinov@exchange.microsoft.com</a>&gt;
wrote:</span></font></span></p>

<div>

<div vlink="blue" link="blue">

<div>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">This doesn't work for my in CPython 2.4 either, so I think
the docs are wrong:</span></font></p>

</div>

<div>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&gt;&gt;&gt; from xml import xpath</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Traceback (most recent call last):</span></font></p>

</div>

<div>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp; File &quot;&lt;stdin&gt;&quot;, line 1, in ?</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">ImportError: cannot import name xpath</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&gt;&gt;&gt; import sys</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&gt;&gt;&gt; sys.version</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">'2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit
(Intel)]'</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&gt;&gt;&gt;&nbsp;</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<div>

<p><font color="navy" face="Bookman Old Style" size="1"><span style="font-size: 8pt; color: navy;"><a href="http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
Do you want to help develop Dynamic languages on CLR?</a> </span></font><font color="white" face="Bookman Old Style" size="1"><span style="font-size: 1pt; color: white;">(<a href="http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">

http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038</a>)</span></font></p>

</div>

<div>

<div style="text-align: center;" align="center"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">

<hr align="center" size="2" width="100%">

</span></font></div>

<p><b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">From:</span></font></b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma;"> <a href="mailto:users-bounces@lists.ironpython.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
users-bounces@lists.ironpython.com</a>
[mailto:<a href="mailto:users-bounces@lists.ironpython.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
users-bounces@lists.ironpython.com</a>] <b><span style="font-weight: bold;">On
Behalf Of </span></b>Greg Lee<br>
<b><span style="font-weight: bold;">Sent:</span></b> Tuesday, May 16, 2006 3:17
PM<br>
<b><span style="font-weight: bold;">To:</span></b> <a href="mailto:users@lists.ironpython.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">users@lists.ironpython.com</a><br>
<b><span style="font-weight: bold;">Subject:</span></b> [IronPython] from xml
import xpath</span></font></p>

</div>

</div>

<div><span>

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&nbsp;</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">I'm
porting an application that uses PyXML.&nbsp; The following from the PyXml
documentation <a href="http://pyxml.sourceforge.net/topics/howto/section-XPath.html" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://pyxml.sourceforge.net/topics/howto/section-XPath.html</a>

doesn't work:</span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt;">from xml import xpath</span></font> <br>
<font face="Courier New" size="2"><span style="font-size: 10pt;">Traceback
(most recent call last):</span></font> <br>
<font face="Courier New" size="2"><span style="font-size: 10pt;">&nbsp;
File , line 0, in input##113</span></font> <br>
<font face="Courier New" size="2"><span style="font-size: 10pt;">ImportError:
cannot import xpath from xml</span></font> </p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Any
suggestions?&nbsp; I messed around with adding site-packages to IRONPYTHONPATH
but other BadThings happened.</span></font> </p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Here's
the installation:</span></font> </p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt;">Microsoft Windows XP [Version 5.1.2600]<br>
IronPython 1.0.60420 (Beta) on .NET 2.0.50727.42<br>
<br>
python 2.4.2<br>
pyxml 0.8.4<br>
pywin32 205<br>
py2exe 0.6.3<br>
<br>
IRONPYTHONPATH = c:\python24\lib</span></font> </p>

</span></div>

</div>

</div>



<p style="margin-bottom: 12pt;"><font face="Times New Roman" size="3"><span style="font-size: 12pt;"><br>
_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@lists.ironpython.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a></span></font>
</p>

</div>

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&nbsp;</span></font></p>

</blockquote>

</span></div><div></div>

</div>



</div><br>_______________________________________________<br>users mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:users@lists.ironpython.com">users@lists.ironpython.com</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br><br><br></blockquote></div><br>