[IronPython] "no module named win32api" using PyWin32-208

Dino Viehland dinov at exchange.microsoft.com
Wed Jun 28 17:37:03 CEST 2006


Ahh, thanks for the BeautifulSoup explanation...  I've opened bug #651 on CodePlex to track it and make sure we don't forget about it post 1.0.

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Mike Raath
Sent: Wednesday, June 28, 2006 8:16 AM
To: Discussion of IronPython
Subject: Re: [IronPython] "no module named win32api" using PyWin32-208

I have gone with ADO.Net on the admin web application, and this is fine as it's running within the .Net web application. It just deviates slightly from the codebase on the server which is running in the standard Python runtime, but I can live with that.


On the BeautifulSoup, sorry - as a newb in the Python sphere I don't know what's common knowledge and what's not. BeautifulSoup is an excellent html parser, much better than the parsers that ship with Python, which sympathetically parses HTML so dealing with missing closing tags and other common malformed html issues - vital if you're scraping html from external sites over which you have no control. The project is here: http://www.crummy.com/software/BeautifulSoup/ and there's a fair bit on the web for it too.

On 6/28/06, Dino Viehland <dinov at exchange.microsoft.com<mailto:dinov at exchange.microsoft.com>> wrote:

I would recommend going w/ .NET ADO.  You can get started w/:



import clr

clr.AddReference('System.Data')



import System.Data as SD



and then you have SD.* available to you.



On the BeautifulSoup object - what is a BeautifulSoup object?  You can either give us more details here, or you can open an issue on CodePlex (http://www.codeplex.com/Wiki/View.aspx?ProjectName=IronPython ).  Unfortunately we're not planning on revisiting performance again until after v1.0 ships, but it is something that we always care about.







From: users-bounces at lists.ironpython.com <mailto:users-bounces at lists.ironpython.com> [mailto:users-bounces at lists.ironpython.com<mailto:users-bounces at lists.ironpython.com>] On Behalf Of Mike Raath
Sent: Tuesday, June 27, 2006 11:01 PM
To: Discussion of IronPython
Subject: Re: [IronPython] "no module named win32api" using PyWin32-208



Thanks, Dino, I'm looking at that. (It's a .pyc, btw)

A bit of background - I've got some Python script running server-side which does screen-scraping based on definitions in a MS SQL Server db, and I'm trying to come up with a maintenance app where an administrator can define the screen-scraping, and view the effect of their definition. The server script uses COM ADO through the win32 extensions, and the admin app is in .Net. I was hoping to be able to use the Python classes as-is, but I can modify the .py file which will live with the webapp slightly so that it uses .Net ADO, or even COM ADO.

It's a great product, by the way. Just one thing - I've been reading about how IronPython is pretty fast, but I've come across an area where it's quite slow. It seems that creating a BeautifulSoup object to parse a web page is slow; not sure if that's something you'd like to benchmark.

Cheers,
Mike

On 6/28/06, Dino Viehland <dinov at exchange.microsoft.com<mailto:dinov at exchange.microsoft.com>> wrote:

We don't support compiled Python modules (PYD's or PYC's, I'm not sure which one pywin32 is though I'd bet PYD) and isn't anything we'll support before 1.0.  But if it's access to Win32 you want, there's a large amount of Win32 exposed through the .NET APIs that you can access directly by importing the appropriate namespaces (and adding references to the appropriate assemblies if it's not mscorlib or System).



That may or may not work for you depending on what your goals are.





________________________________

From: users-bounces at lists.ironpython.com<mailto:users-bounces at lists.ironpython.com> On Behalf Of Mike Raath
Sent: Tuesday, June 27, 2006 10:21 PM
To: users at lists.ironpython.com<mailto:users at lists.ironpython.com>
Subject: [IronPython] "no module named win32api" using PyWin32-208

I posted this on the comp.lang.python<http://groups.google.co.za/group/comp.lang.python>  list yesterday but am not sure if that is the correct list to have posted on, so apologies for the cross-post but I would really appreciate some help on this.

I have Python 2.4 installed on my local machine in c:\Python24. I have
also downloaded the python for windows extensions installer
pywin32-208.win32-py2.4.exe and installed this to
C:\Python24\Lib\site-packages

Trying to run a python script through a C# console app is causing me
problems: the last line of code in the following block results in a no
module named win32ap error. I'm not sure if this is because there is no
win32api.py in the win32 folder off site-packages, just a win32api.pyc
file.

            m_engine = new PythonEngine();

            m_engine.AddToPath("C:\\Python24\\DLLs");
            m_engine.AddToPath("C:\\Python24\\lib");
            m_engine.AddToPath("C:\\Python24\\lib\\plat-win");
            m_engine.AddToPath("C:\\Python24\\lib\\lib-tk");

m_engine.AddToPath("C:\\Python24\\Lib\\site-packages\\pythonwin");
            m_engine.AddToPath("C:\\Python24");
            m_engine.AddToPath("C:\\Python24\\lib\\site-packages");

m_engine.AddToPath("C:\\Python24\\lib\\site-packages\\win32");

m_engine.AddToPath("C:\\Python24\\lib\\site-packages\\win32\\lib");

            m_engine.Execute("from win32api import win32api");

I have added all the addtopaths to get the path to match the sys.path I
see in a normal python console which can successfully import the
module.

Incidentally, I have tried making the last line
             m_engine.Execute("import win32api");
with no luck.

Can the win32 extensions handle compiled python modules? If not how can
I get it to work?

Thanks,
Mike

_______________________________________________
users mailing list
users at lists.ironpython.com<mailto:users at lists.ironpython.com>
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



_______________________________________________
users mailing list
users at lists.ironpython.com<mailto:users at lists.ironpython.com>
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20060628/19e68f4b/attachment.html>


More information about the Ironpython-users mailing list