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


Groups > comp.lang.python > #42133

Re: No errors displayed but i blank scren nstead.

Newsgroups comp.lang.python
Date 2013-03-28 07:46 -0700
References <ce228c70-4adb-46b2-be10-93dde6a39760@googlegroups.com> <96fcb30a-9857-4016-ae6e-7b07eab2d03a@googlegroups.com>
Message-ID <1f7b3a17-8f90-48c8-889c-d60da47a2f47@googlegroups.com> (permalink)
Subject Re: No errors displayed but i blank scren nstead.
From Νίκος Γκρ33κ <nikos.gr33k@gmail.com>

Show all headers | View raw


Τη Πέμπτη, 28 Μαρτίου 2013 4:42:59 μ.μ. UTC+2, ο χρήστης Miki Tebeka έγραψε:

> Please post the code to the script, otherwise we can't help you.

I wanted to make my website running Python 3 which is more new and bette:)

i treid to execute metrites.py via my jailed shell, please take a look if i'am not tiring you and maybe you can see if there is nothign wrong because i dont see nayhting.

The gethostbyaddr at the end its because the script run in cmd instead of in a browser.
Please help, its alkmost ready to run correctly!


[code]
nikos@superhost.gr [~/www/cgi-bin]# /usr/bin/python3 metrites.py 
<!--: spam
Content-Type: text/html

<body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> -->
<body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> --> -->
</font> </font> </font> </script> </object> </blockquote> </pre>
</table> </table> </table> </table> </table> </font> </font> </font><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#6622aa">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>KeyError</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial">Python 3.2.3: /usr/bin/python3<br>Thu Mar 28 09:41:53 2013</font></td></tr></table>
    
<p>A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.</p>
<table width="100%" cellspacing=0 cellpadding=0 border=0>
<tr><td bgcolor="#d8bbff"><big>&nbsp;</big><a href="file:///home/nikos/public_html/cgi-bin/metrites.py">/home/nikos/public_html/cgi-bin/metrites.py</a> in <strong><module></strong>()</td></tr>
<tr><td><font color="#909090"><tt>&nbsp;&nbsp;<small>&nbsp;&nbsp;&nbsp;26</small>&nbsp;userform&nbsp;=&nbsp;form.getvalue('userform')<br>
</tt></font></td></tr>
<tr><td><font color="#909090"><tt>&nbsp;&nbsp;<small>&nbsp;&nbsp;&nbsp;27</small>&nbsp;<br>
</tt></font></td></tr>
<tr><td bgcolor="#ffccee"><tt>=&gt;<small>&nbsp;&nbsp;&nbsp;28</small>&nbsp;host&nbsp;=&nbsp;socket.gethostbyaddr(&nbsp;os.environ['REMOTE_ADDR']&nbsp;)[0]<br>
</tt></td></tr>
<tr><td><font color="#909090"><tt>&nbsp;&nbsp;<small>&nbsp;&nbsp;&nbsp;29</small>&nbsp;date&nbsp;=&nbsp;(&nbsp;datetime.utcnow()&nbsp;+&nbsp;timedelta(hours=2)&nbsp;).strftime(&nbsp;'%y-%m-%d&nbsp;%H:%M:%S'&nbsp;)<br>
</tt></font></td></tr>
<tr><td><font color="#909090"><tt>&nbsp;&nbsp;<small>&nbsp;&nbsp;&nbsp;30</small>&nbsp;userinfo&nbsp;=&nbsp;os.environ['HTTP_USER_AGENT']<br>
</tt></font></td></tr>
<tr><td><small><font color="#909090">host <em>undefined</em>, <strong>socket</strong>&nbsp;= &lt;module 'socket' from '/opt/python3/lib/python3.2/socket.py'&gt;, socket.<strong>gethostbyaddr</strong>&nbsp;= &lt;built-in function gethostbyaddr&gt;, <strong>os</strong>&nbsp;= &lt;module 'os' from '/opt/python3/lib/python3.2/os.py'&gt;, os.<strong>environ</strong>&nbsp;= environ({'PROMPT_COMMAND': 'history -a', 'PERL_M...xa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:'})</font></small></td></tr></table>
<table width="100%" cellspacing=0 cellpadding=0 border=0>
<tr><td bgcolor="#d8bbff"><big>&nbsp;</big><a href="file:///opt/python3/lib/python3.2/os.py">/opt/python3/lib/python3.2/os.py</a> in <strong>__getitem__</strong>(self=environ({'PROMPT_COMMAND': 'history -a', 'PERL_M...xa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:'}), key='REMOTE_ADDR')</td></tr>
<tr><td><font color="#909090"><tt>&nbsp;&nbsp;<small>&nbsp;&nbsp;448</small>&nbsp;<br>
</tt></font></td></tr>
<tr><td><font color="#909090"><tt>&nbsp;&nbsp;<small>&nbsp;&nbsp;449</small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def&nbsp;__getitem__(self,&nbsp;key):<br>
</tt></font></td></tr>
<tr><td bgcolor="#ffccee"><tt>=&gt;<small>&nbsp;&nbsp;450</small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;value&nbsp;=&nbsp;self._data[self.encodekey(key)]<br>
</tt></td></tr>
<tr><td><font color="#909090"><tt>&nbsp;&nbsp;<small>&nbsp;&nbsp;451</small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;self.decodevalue(value)<br>
</tt></font></td></tr>
<tr><td><font color="#909090"><tt>&nbsp;&nbsp;<small>&nbsp;&nbsp;452</small>&nbsp;<br>
</tt></font></td></tr>
<tr><td><small><font color="#909090">value <em>undefined</em>, <strong>self</strong>&nbsp;= environ({'PROMPT_COMMAND': 'history -a', 'PERL_M...xa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:'}), self.<strong>_data</strong>&nbsp;= {b'CLASSPATH': b'.:/usr/local/jdk/lib/classes.zip', b'CVS_RSH': b'ssh', b'EDITOR': b'pico', b'GREP_COLOR': b'1;32', b'GREP_OPTIONS': b'--color', b'G_BROKEN_FILENAMES': b'1', b'HISTSIZE': b'5000', b'HOME': b'/home/nikos', b'HOSTNAME': b'menara.websitewelcome.com', b'INPUTRC': b'/etc/inputrc', ...}, self.<strong>encodekey</strong>&nbsp;= &lt;function encode&gt;, <strong>key</strong>&nbsp;= 'REMOTE_ADDR'</font></small></td></tr></table><p><strong>KeyError</strong>: b'REMOTE_ADDR'
<br><tt><small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</small>&nbsp;</tt>args&nbsp;=
(b'REMOTE_ADDR',)
<br><tt><small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</small>&nbsp;</tt>with_traceback&nbsp;=
&lt;built-in method with_traceback of KeyError object&gt;


<!-- The above is a description of an error in a Python program, formatted
     for a Web browser because the 'cgitb' module was enabled.  In case you
     are not reading this in a Web browser, here is the original traceback:

Traceback (most recent call last):
  File "metrites.py", line 28, in &lt;module&gt;
    host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0]
  File "/opt/python3/lib/python3.2/os.py", line 450, in __getitem__
    value = self._data[self.encodekey(key)]
KeyError: b'REMOTE_ADDR'

-->
[/code]

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


Thread

No errors displayed but i blank scren nstead. Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-28 07:19 -0700
  Re: No errors displayed but i blank scren nstead. Miki Tebeka <miki.tebeka@gmail.com> - 2013-03-28 07:42 -0700
    Re: No errors displayed but i blank scren nstead. Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-28 07:46 -0700
      Re: No errors displayed but i blank scren nstead. Chris Angelico <rosuav@gmail.com> - 2013-03-29 01:58 +1100
        Re: No errors displayed but i blank scren nstead. Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-28 08:04 -0700
        Re: No errors displayed but i blank scren nstead. Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-28 08:04 -0700
          Re: No errors displayed but i blank scren nstead. Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-28 08:20 -0700
            Re: No errors displayed but i blank scren nstead. Chris Angelico <rosuav@gmail.com> - 2013-03-29 02:25 +1100
              Re: No errors displayed but i blank scren nstead. Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-28 08:51 -0700
                Re: No errors displayed but i blank scren nstead. Chris Angelico <rosuav@gmail.com> - 2013-03-29 02:59 +1100
                Re: No errors displayed but i blank scren nstead. Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-28 09:10 -0700
                Re: No errors displayed but i blank scren nstead. Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-28 09:10 -0700
              Re: No errors displayed but i blank scren nstead. Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-28 08:51 -0700
              Re: No errors displayed but i blank scren nstead. Walter Hurry <walterhurry@lavabit.com> - 2013-03-28 17:24 +0000
                Re: No errors displayed but i blank scren nstead. Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-28 10:47 -0700
                Re: No errors displayed but i blank scren nstead. Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-28 11:37 -0700
                Re: No errors displayed but i blank scren nstead. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-03-28 19:02 +0000
                Re: No errors displayed but i blank scren nstead. Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-28 12:05 -0700
                Re: No errors displayed but i blank scren nstead. Joel Goldstick <joel.goldstick@gmail.com> - 2013-03-28 15:24 -0400
                Re: No errors displayed but i blank scren nstead. Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-28 12:05 -0700
          Re: No errors displayed but i blank scren nstead. Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-28 08:20 -0700
    Re: No errors displayed but i blank scren nstead. Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-28 07:54 -0700
    Re: No errors displayed but i blank scren nstead. Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-28 08:56 -0700
  Re: No errors displayed but i blank scren nstead. nagia.retsina@gmail.com - 2013-03-29 12:26 -0700
    Re: No errors displayed but i blank scren nstead. nagia.retsina@gmail.com - 2013-03-29 12:27 -0700
      Re: No errors displayed but i blank scren nstead. Chris Angelico <rosuav@gmail.com> - 2013-03-30 06:34 +1100
        Re: No errors displayed but i blank scren nstead. Neil Cerutti <neilc@norwich.edu> - 2013-03-29 20:14 +0000
          Re: No errors displayed but i blank scren nstead. Walter Hurry <walterhurry@lavabit.com> - 2013-03-29 21:14 +0000
        Re: No errors displayed but i blank scren nstead. nagia.retsina@gmail.com - 2013-03-29 13:34 -0700
        Re: No errors displayed but i blank scren nstead. nagia.retsina@gmail.com - 2013-03-29 13:34 -0700
  Re: No errors displayed but i blank scren nstead. nagia.retsina@gmail.com - 2013-03-29 12:27 -0700

csiph-web