Trouble with Python in ASP development 
Author Message
 Trouble with Python in ASP development

Hi,

I'm trying to use python as script-language in ASP, using MS IIS.
When something in my python-code raises an exception the loading of the page
just stops,
and nothhing after the code that raises the exception is sent to the client.
No error-message is given.

I've written a fairly simple three-tier architectured app, that simplifies
the work in the application layer, the actual ASP-page.

In my asp-page there's some code handling a set of form-inputs if the
parameter 'action' is passed with the value 'new' in the url.

<%
action = str(Request("action"))
if action == 'new':
 from gat_reg.logic.classes import Kunde
 firmanavn = str(Request("firmanavn"))
 adresse = str(Request("adresse"))
 postadresse = str(Request("postadresse"))
 telefon = str(Request("telefon"))
 fax = str(Request("fax"))
 email = str(Request("email"))
 k = Kunde(firmanavn, adresse, postadresse, telefon, fax, email)
 k.save()
%>

the Kunde-object is stored in the middle-tier of the application and calling
k.save() should raise an exception if something goes wrong. By calling it
the way I've typed it above nothing below this code will be sent to the
client. If I put a try: except around the code handling the k = Kunde(...)
and k.save() it goes ok, so I understand that something goes wrong around
there somewhere, but ISS doesn't give any information.

Is there any way to get more info from ISS or find out what goes wrong?
Passing the same parameters to a Kunde-object in the python interpreter
works just fine. In ASP it just won't work.

Any clues would be highly appreciated.

Thomas



Tue, 18 Nov 2003 00:19:09 GMT  
 Trouble with Python in ASP development

Quote:

> Is there any way to get more info from ISS or find out what
> goes wrong?
> Passing the same parameters to a Kunde-object in the python
> interpreter
> works just fine. In ASP it just won't work.

I would put some debug code into the Kunde object and see what happens in
there. Or better yet, write some unittest to the kunde object.

Then print the errormessages to a file.

btw. a small optimisation of your code. Sorry couldn't help it.

def getParams(params):
    "Helper function"
    paramDict = {}
    for param in params:
        paramDict[param] = str(Request(param))
    return paramDict

k = Kunde(**getParams(['firmanavn', 'adresse', 'postadresse']))

Hav en god dag

    Max M



Tue, 18 Nov 2003 17:20:02 GMT  
 Trouble with Python in ASP development

Quote:

> I'm trying to use python as script-language in ASP, using MS
IIS.
> When something in my python-code raises an exception the
loading of the
> page
> just stops,
> and nothhing after the code that raises the exception is sent
to the
> client.
> No error-message is given.

I've never known the exception not be displayed, unless you
suppress it.  Try viewing the HTML source in the browser to see
if the message is hiding.

Quote:
> Is there any way to get more info from ISS or find out what
goes wrong?
> Passing the same parameters to a Kunde-object in the python
interpreter
> works just fine. In ASP it just won't work.

I'm not sure what your problem is here.  The exceptions IIS
generates are of type com_error.  So put

from pywintypes import com_error

at the top of the page.  Then some exception handling could be

except com_error, ohdear:
  Response.Write(str(ohdear))

Which, IIRC, shows what would have been displayed if you hadn't
caught the exception.  It does have to be str and not repr in
this case.

All of which may have no connection with what you wanted to know
...

                Graham



Sat, 22 Nov 2003 20:33:15 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Trouble with Python and ASP

2. Trouble with IIS Python ASP

3. Troubles with Clarion ODBC and ASP

4. ASP troubles

5. Trouble with cgi.FieldStorage() on iis/asp

6. Python 2.2 + Win32All 146 = Python/ASP Failures

7. Unicode + SuperUltraAllNewGetItNow Python Upgrade questions: ASP/VBScript->Python

8. SV ASP vs Fenix ASP

9. .asp or .inc for include files in ASP

10. Rexx and ASP/ASP.NET

11. Global object in ASP (calling other scripting languages in ASP pages)

12. using com object written in python from iis/asp

 

 
Powered by phpBB® Forum Software