Найти - Пользователи
Полная версия: Ошибка - CGI Script
Начало » Web » Ошибка - CGI Script
1
daivd_yusupov
Новичке, в разработки на Python

Не могу понять в чем проблема и как следствие ее решить.

#!C:\Programs\Python\Python39\python.exe
# -*- coding: utf-8 -*-

# Когда подключаю, модули import cgi - возникает ошибка
#import cgi, cgitb
#data = cgi.FieldStorage()
#first_name = data.getvalue('first_name')
#last_name = data.getvalue('last_name')

first_name = ‘first_name’
last_name = ‘last_name’

print('Content-type: text/html\n')
print('<!DOCTYPE HTML>')
print('<html>')
print(' <head>')
print(' <meta charset=“UTF-8”>')
print(' <title>Привет как дела</title>')
print(' </head>')
print(' <body>')
print(' <h1>Обработка данных форм!</h1>')
print(' <h1>Hello Worl!',first_name,last_name,'</h1>')
print(' </body>')
print('</html>')


# Запроса лог

mod_authz_core.c(817): AH01626: authorization result of Require all granted: granted
mod_authz_core.c(817): AH01626: authorization result of <RequireAny>: granted
End of script output before headers: sp1.py
AH01215: Traceback (most recent call last):\r: Dapp/Apache24/htdocs/sample/sp1.py
AH01215: File “D:\\app\\Apache24\\htdocs\\sample\\sp1.py”, line 4, in <module>\r: Dapp/Apache24/htdocs/sample/sp1.py
AH01215: import cgi, cgitb\r: Dapp/Apache24/htdocs/sample/sp1.py
AH01215: File “C:\\Programs\\Python\\Python39\\lib\\cgi.py”, line 39, in <module>\r: Dapp/Apache24/htdocs/sample/sp1.py
AH01215: from email.parser import FeedParser\r: Dapp/Apache24/htdocs/sample/sp1.py
AH01215: File “C:\\Programs\\Python\\Python39\\lib\\email\\parser.py”, line 12, in <module>\r: Dapp/Apache24/htdocs/sample/sp1.py
AH01215: from email.feedparser import FeedParser, BytesFeedParser\r: Dapp/Apache24/htdocs/sample/sp1.py
AH01215: File “C:\\Programs\\Python\\Python39\\lib\\email\\feedparser.py”, line 27, in <module>\r: Dapp/Apache24/htdocs/sample/sp1.py
AH01215: from email._policybase import compat32\r: Dapp/Apache24/htdocs/sample/sp1.py
AH01215: File “C:\\Programs\\Python\\Python39\\lib\\email\\_policybase.py”, line 9, in <module>\r: Dapp/Apache24/htdocs/sample/sp1.py
AH01215: from email.utils import _has_surrogates\r: Dapp/Apache24/htdocs/sample/sp1.py
AH01215: File “C:\\Programs\\Python\\Python39\\lib\\email\\utils.py”, line 29, in <module>\r: Dapp/Apache24/htdocs/sample/sp1.py
AH01215: import socket\r: Dapp/Apache24/htdocs/sample/sp1.py
AH01215: File “C:\\Programs\\Python\\Python39\\lib\\socket.py”, line 54, in <module>\r: Dapp/Apache24/htdocs/sample/sp1.py
AH01215: import os, sys, io, selectors\r: Dapp/Apache24/htdocs/sample/sp1.py
AH01215: File “C:\\Programs\\Python\\Python39\\lib\\selectors.py”, line 12, in <module>\r: Dapp/Apache24/htdocs/sample/sp1.py
AH01215: import select\r: Dapp/Apache24/htdocs/sample/sp1.py
AH01215: File “D:\\app\\Apache24\\htdocs\\sample\\select.py”, line 6, in <module>\r: Dapp/Apache24/htdocs/sample/sp1.py
AH01215: data = cgi.FieldStorage()\r: Dapp/Apache24/htdocs/sample/sp1.py
AH01215: AttributeError: partially initialized module ‘cgi’ has no attribute ‘FieldStorage’ (most likely due to a circular import)\r: Dapp/Apache24/htdocs/sample/sp1.py
daivd_yusupov
В ходе работы CGI – скриптами обнаружил, что они работают без проблем с cgi-bin. Веб сервера Apache
daivd_yusupov
Могу предположить, что есть проблема настройки web – сервера на Apache или особенность cgi.py
daivd_yusupov
Решил отказаться от этой идеи
py.user.next
Используй Flask. CGI - слишком древняя фигня.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB