2012-02-06 51 views
0

呼叫請求時,這裏是我的ASP代碼:類型錯誤: 'NamedScriptAttribute' 在ASP與ActivePython3

<%@ Language = Python%> 
<% 
def main(): 
    a = Request("btnSubmit") 
main() 
%> 

這是給我的錯誤:

Error Type: 
    Python ActiveX Scripting Engine (0x80020009) 
    Traceback (most recent call last): File "<Script Block >", line 3, in <module> main() File "<Script Block >", line 2, in main a = Request("btnSubmit") TypeError: 'NamedScriptAttribute' object is not callable 
    /website/test.asp, line 4 
    a = Request("btnSubmit") 

Browser Type: 
Mozilla/5.0 (Windows NT 5.1; rv:9.0.1) Gecko/20100101 Firefox/9.0.1 

Page: 
GET /website/test.asp 

任何想法,爲什麼我得到這個錯誤?

我設法讓這個腳本才能正常工作:

<%@ Language = Python%> 
<% 
def main(): 
    Response.Write("My first ASP script!") 
main() 
%> 

除了這一個使用VBScript:

<% 
a = Request("btnSubmit") 
%> 

的事情是,我的工作項目計劃在不久的將來將它移植到ASP .NET中,這讓我更加熟悉。不過,現在我需要與ASP Classic握手。然而,當我看到如何使用VBScript實現事情時,我覺得自己在哭,並認爲必須有更好的方式來做到這一點。這就是爲什麼我想盡可能使用Python。但它是穩定的嗎?這是值得的努力?請指教。

感謝,

巴里

回答

0

我覺得這是我應該做的事情:

<%@ Language = Python%> 
<% 
def main(): 
    a = Request.QueryString["btnSubmit"] 
main() 
%> 

我不知道什麼請求( 「btnSubmit按鈕」)實際上是在做,因爲它是沒有在這裏記錄:

http://www.w3schools.com/asp/asp_ref_request.asp