0

I'm trying to run a Python script on Abyss Web Server Console on my local machine. Here are the scripting parameters that I've configured... Scripting Parameters And the Python script that I'm trying to run..

import cgi

form = cgi.FieldStorage()
print('Content-Type:text/html; charset=utf-8')
print('\r\n\r\n')
print('''<!DOCTYPE html>
<html><title>Web Server Response</title>
<style>tr,th,td{border:2px solid Gray}</style>''')
print('<table style"width:500px"><tr><th>Key<th>Value')
for i in form.keys():
    key = str(i)
    val = str(form.getvalue(key))
    print('<tr><td>' + key + '<td>' + val)

print('''</tr></table>)
<img src="pwrabyss.gif"> </html>''')

I've saved it as "C:\Abyss Web Server\htdocs\echo.py"

I was expecting a page with an empty table containing two headers labeled "Key" and "Value"

When I enter "http://localhost/echo.py" into my browser though, I get a result of "Error 500: Internal server error."

I've tried disabling my firewall and antivirus. I've tried simplifying the python code to this...

print ("Content-Type: text/html")
print ()
print("<h1>Hello World!</h1>")

No matter what I do I still get the same result.

When I look in the cgi.log file I see entries that say, "Bad executable" at the end. When I run the script from the command prompt though it works as expected.

What am I doing wrong?

1 Answers1

0

Installing Python 3.11 in the "Program Files" folder, and then changing the interpreter in the "Scripting Parameters" page fixed the issue for me.

I originally installed Python using a download link on "ActiveState.com" that doesn't give you a choice about where to install, as per the instructions in the book I'm reading. I'm not sure if it was the location of the interpreter or the installation itself that was the issue. Either way, a fresh install in program files resolved the problem.

The book seems to be outdated so I hope this helps someone else who's having the same issue.