Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

500 Server Error for Python in ASP Script

The following asp script is giving me the error: "HTTP/1.1 500 Server Error"

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

when I run it on IIS 7.5 Windows 7 (64 bit). In the error log it simply mentions an ASP_0147 error.

I have installed Python 3.2 and Active Python 3.2.2.3 on the server and registered Python via: pyscript.py

I have enabled 32-bit applications for the server. I have also installed Python for Windows to see if that would help.

Can you suggest how I might fix this?

UPDATE:

I have managed to get this working now for python3 but I have to register with --debug, as follows:

C:\Python32\Lib\site-packages\win32comext\axscript\client>c:\Python32\python.exe
 pyscript.py --debug
Requesting elevation and retrying...
Registered: Python (for debugging)

Why will it only work in debug mode? Is it safe to run in this mode?

Here's the trace when debug is enabled:

Object with win32trace dispatcher created (object=None)
in <win32com.axscript.client.pyscript.PyScript object at 0x00000000035946A0>._InvokeEx_-SetScriptSite(<PyIActiveScriptSite at 0x00000000036923B0 with obj at 0x000000000056FFD8>,) [1,0,None]
Debugging extensions (axdebug) module does not exist - debugging is disabled.. 
in <win32com.axscript.client.pyscript.PyScript object at 0x00000000035946A0>._QueryInterface_ with unsupported IID IActiveScriptProperty ({4954E0D0-FBC7-11D1-8410-006008C3FBFC})
in <win32com.axscript.client.pyscript.PyScript object at 0x00000000035946A0>._InvokeEx_-InitNew() [1,0,None]
in <win32com.axscript.client.pyscript.PyScript object at 0x00000000035946A0>._InvokeEx_-GetScriptDispatch(None,) [1,0,None]
in <win32com.axscript.client.pyscript.PyScript object at 0x00000000035946A0>._QueryInterface_ with unsupported IID {1D044690-8923-11D0-ABD2-00A0C911E8B2} ({1D044690-8923-11D0-ABD2-00A0C911E8B2})
in <win32com.axscript.client.pyscript.PyScript object at 0x00000000035946A0>._InvokeEx_-AddNamedItem('Response', 66) [1,0,None]
in <win32com.axscript.client.pyscript.PyScript object at 0x00000000035946A0>._InvokeEx_-AddNamedItem('Request', 66) [1,0,None]
in <win32com.axscript.client.pyscript.PyScript object at 0x00000000035946A0>._InvokeEx_-AddNamedItem('Server', 66) [1,0,None]
in <win32com.axscript.client.pyscript.PyScript object at 0x00000000035946A0>._InvokeEx_-AddNamedItem('Session', 66) [1,0,None]
in <win32com.axscript.client.pyscript.PyScript object at 0x00000000035946A0>._InvokeEx_-AddNamedItem('Application', 66) [1,0,None]
in <win32com.axscript.client.pyscript.PyScript object at 0x00000000035946A0>._InvokeEx_-AddNamedItem('ObjectContext', 66) [1,0,None]
in <win32com.axscript.client.pyscript.PyScript object at 0x00000000035946A0>._InvokeEx_-AddNamedItem('ASPGLOBALTLB', 74) [1,0,None]
in <win32com.axscript.client.pyscript.PyScript object at 0x00000000035946A0>._InvokeEx_-ParseScriptText('def main():\r\n    Response.Write("My first ASP script!")\r\nmain()\r\n', None, None, 'STRIP EMBEDDED HTML COMMENTS', 0, 1, 192, 0) [1,0,None]
in <win32com.axscript.client.pyscript.PyScript object at 0x00000000035946A0>._InvokeEx_-GetScriptDispatch(None,) [1,0,None]
in <win32com.axscript.client.pyscript.PyScript object at 0x00000000035946A0>._InvokeEx_-AddNamedItem('ScriptingNamespace', 10) [1,0,None]
in <win32com.axscript.client.pyscript.PyScript object at 0x00000000035946A0>._InvokeEx_-SetScriptState(1,) [1,0,None]
in <win32com.axscript.client.pyscript.PyScript object at 0x00000000035946A0>._InvokeEx_-SetScriptState(0,) [1,0,None]
in <win32com.axscript.client.pyscript.PyScript object at 0x00000000035946A0>._InvokeEx_-Close() [1,0,None]

Thanks,

Barry

like image 212
Baz Avatar asked Feb 12 '12 20:02

Baz


People also ask

How do I fix an internal server error in Python?

With Perl or Python scripts, a common reason for an “Internal Server Error” message is that you've uploaded a script in the wrong "mode" in your FTP program. In particular, Perl and Python scripts should always be uploaded in "ASCII" or "text" mode, not "binary" mode.

How do I create a 500 internal server error?

The 500 Internal Server error could be caused by an error during the execution of any policy within Edge or by an error on the target/backend server. The HTTP status code 500 is a generic error response. It means that the server encountered an unexpected condition that prevented it from fulfilling the request.

How do I fix 500 Internal server error in IIS?

IIS error The error 500.19 is an internal server error often occurring on a server using Microsoft IIS software. It indicates that the configuration data for the page is invalid. To solve the issue, delete the malformed XML element from the Web. config file or from the ApplicationHost.

What is internal server error?

The HyperText Transfer Protocol (HTTP) 500 Internal Server Error server error response code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request. This error response is a generic "catch-all" response.


1 Answers

May not be the appropriate solution, in the past I've had this problem.
The recent versions of activepython seems broken for active scripting.
I was able just the version 2.5.6.10.
If the version is not important, you could try that older version.

like image 153
Kul-Tigin Avatar answered Nov 04 '22 01:11

Kul-Tigin