ActivePython2.0 - Server Side objects for ASP problem

Satheesh Babu vsbabu at erols.com
Wed Jan 10 20:04:53 EST 2001


Hi,

I'm trying to use a server side python object to be called from a VBScript
ASP code.
It works nicely for simple things. When I try to use urllib functions, I get
an error. Any
idea? The second function works nicely. I'm using Win98, PWS with Build202.
I'll try
on NT4.0 IIS tomorrow. Any help is greatly appreciated.

----------------- ASP file -----------------
<% @LANGUAGE="VBSCRIPT" %>
<!--#include file="pymod.asp"-->
<%= SlurpURL("http://vsbabu.csoft.net/") %>
<%= CapitalizeIt("the first letter should be capitalized") %>

----------------pymod.asp------------------
<script language='python' runat='server'>
from urllib import *
from string import *

def SlurpURL(i_url):
    f = urlopen(i_url)
    o_data = f.read()
    f.close()
    return o_data

def CapitalizeIt(i_str)
    return capitalize(i_str)


</script>
------------------ error message -----------------
Python ActiveX Scripting Engine error '80020009'

Traceback (innermost last): File "<Script Block >", line 4, in SlurpURL f =
urlopen(i_url) File "c:\python20\lib\urllib.py", line 61, in urlopen return
_urlopener.open(url) File "c:\python20\lib\urllib.py", line 166, in open
return getattr(self, name)(url) File "c:\python20\lib\urllib.py", line 248,
in open_http host, selector = url ValueError: unpack sequence of wrong size

?

host, selector = url

======================

I've a requirement to do some network socket programming, which should be
added to
lot of existing ASP (VBSCript) code. I don't know of any way to do that in
ASP, short
of COM component development, which I don't want to know. So my idea is to
use
an existing Python code which works very well stand alone (it also works as
a
Python ASP script), use it as a server side object and then call it from
existing
ASP-VBScript pages. Suits are going to bar me from converting all VBScript
pages to Python :-(

Alternate ideas are also welcome!

Many thanks in advance


--
v.s.babu
vsbabu at erols.com
http://vsbabu.csoft.net





More information about the Python-list mailing list