I looked at the .c for the likely PYD, and it's not playing tricks with the paths---I think the problem is simply IP's not supporting PYD format. 
 
If IP can't import from PYD format, perhaps it could throw an exception that identifies the offending pyd rather than just identifying the original import statement, which in this case is five levels up.  That's the only improvement in user experience that's warranted.

Writing an xpath wrapper around System.Xml.Xpath is not a good use of anyone's time now and probably a dead-end in the long-term.

 -----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Dino Viehland
Sent: Friday, May 19, 2006 10:26 AM
To: Discussion of IronPython
Subject: Re: [IronPython] from xml import xpath

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.  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).

 

Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038)


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Greg Lee
Sent: Friday, May 19, 2006 10:18 AM
To: Discussion of IronPython
Subject: Re: [IronPython] from xml import xpath

 

Is a better diagnostic message possible?  This would let us distinguish a pyd problem from "playing tricks with paths", and presumably there might be some value in fixing any problems in the latter.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Dino Viehland
Sent: Wednesday, May 17, 2006 11:50 AM
To: Discussion of IronPython
Subject: Re: [IronPython] from xml import xpath

You’re right, I did miss that…  Looking at this page: http://pyxml.sourceforge.net/topics/howto/section-install.html  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).

 

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).  For example:

 

import clr

clr.AddReference(‘System.Xml’)

import System.Xml.XPath as XPath

 

xpathDoc = XPath.XPathDocument(‘file://foo.txt’)

 

 

 

Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038)


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Simon Dahlbacka
Sent: Wednesday, May 17, 2006 11:41 AM
To: Discussion of IronPython
Subject: Re: [IronPython] from xml import xpath

 

Dino, you seemed to have missed the part about pyxml..

It works in cpython with pyxml installed. However, pyxml is playing tricks with paths etc, and there might even be pyd:s involved..

C:\Python24>python.exe
Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import xml
>>> xml.__file__
'C:\\Python24\\lib\\site-packages\\_xmlplus\\__init__.pyc'
>>> from xml import xpath
>>>

On 5/17/06, Dino Viehland <[EMAIL PROTECTED]> wrote:

This doesn't work for my in CPython 2.4 either, so I think the docs are wrong:

 

>>> from xml import xpath

Traceback (most recent call last):

  File "<stdin>", line 1, in ?

ImportError: cannot import name xpath

>>> import sys

>>> sys.version

'2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)]'

>>> 

 


From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED]] On Behalf Of Greg Lee
Sent: Tuesday, May 16, 2006 3:17 PM
To: [email protected]
Subject: [IronPython] from xml import xpath

 

I'm porting an application that uses PyXML.  The following from the PyXml documentation http://pyxml.sourceforge.net/topics/howto/section-XPath.html doesn't work:

from xml import xpath
Traceback (most recent call last):
  File , line 0, in input##113
ImportError: cannot import xpath from xml

Any suggestions?  I messed around with adding site-packages to IRONPYTHONPATH but other BadThings happened.

Here's the installation:

Microsoft Windows XP [Version 5.1.2600]
IronPython 1.0.60420 (Beta) on .NET 2.0.50727.42

python 2.4.2
pyxml 0.8.4
pywin32 205
py2exe 0.6.3

IRONPYTHONPATH = c:\python24\lib


_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

 

_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to