Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #103118

Re: Weird and sparese cgi:error

Newsgroups comp.lang.python
Date 2016-02-18 06:47 -0800
References <813cd989-bc60-4d24-96ef-f20244d91362@googlegroups.com> <a0be3911-299e-4647-abca-3ed1f7acd453@googlegroups.com> <mailman.208.1455717207.22075.python-list@python.org>
Message-ID <5a3b0097-0be2-4f30-974d-1ee02a1d81d2@googlegroups.com> (permalink)
Subject Re: Weird and sparese cgi:error
From Φώντας Λαδοπρακόπουλος <nikos.gr33k@gmail.com>

Show all headers | View raw


[root@nexus cgi-bin]# head -10 ./metrites.py 
#!/usr/bin/python3
# coding=utf-8

import cgitb; cgitb.enable()
import cgi, re, os, sys, socket, time, datetime, locale, codecs, random, smtplib, subprocess, pymysql, geoip2.database
from datetime import datetime, timedelta
from http import cookies


#needed line, script does *not* work without it
[root@nexus cgi-bin]# ^C
[root@nexus cgi-bin]# /usr/bin/python3 
Python 3.3.2 (default, Aug 14 2014, 14:25:52) 
[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
KeyboardInterrupt
>>> 
KeyboardInterrupt
>>> quit()
[root@nexus cgi-bin]# 
[root@nexus cgi-bin]# /usr/bin/python3 ./metrites.py 
Error in sys.excepthook:
ValueError: underlying buffer has been detached

Original exception was:
Traceback (most recent call last):
  File "/opt/rh/python33/root/usr/lib64/python3.3/os.py", line 673, in __getitem__
    value = self._data[self.encodekey(key)]
KeyError: b'HTTP_USER_AGENT'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./metrites.py", line 22, in <module>
    userinfo = os.environ['HTTP_USER_AGENT']
  File "/opt/rh/python33/root/usr/lib64/python3.3/os.py", line 676, in __getitem__
    raise KeyError(key)
KeyError: 'HTTP_USER_AGENT'
[root@nexus cgi-bin]# ^C

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Weird and sparese cgi:error Φώντας Λαδοπρακόπουλος <nikos.gr33k@gmail.com> - 2016-02-16 12:02 -0800
  Re: Weird and sparese cgi:error Jeremy Leonard <jrmy.lnrd@gmail.com> - 2016-02-17 05:47 -0800
    Re: Weird and sparese cgi:error Chris Angelico <rosuav@gmail.com> - 2016-02-18 00:53 +1100
      Re: Weird and sparese cgi:error Φώντας Λαδοπρακόπουλος <nikos.gr33k@gmail.com> - 2016-02-18 06:47 -0800
    Re: Weird and sparese cgi:error Φώντας Λαδοπρακόπουλος <nikos.gr33k@gmail.com> - 2016-02-18 06:45 -0800

csiph-web