473,657 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

KeyError

Hello.
Maybe someone will help me with this KeyError:

............... ..............
Traceback (most recent call last):
File "C:\Python\tabl a.py", line 929, in -toplevel-
tablesDirectory = tablesDirectory Prefix + os.environ['REMOTE_ADDR']
File "C:\Python23\li b\os.py", line 417, in __getitem__
return self.data[key.upper()]
KeyError: 'REMOTE_ADDR'
............... ............
Thanks for reading this.
R.

Jul 18 '05 #1
1 5310
ro*******@gazet a.pl wrote:
Hello.
Maybe someone will help me with this KeyError:

............... .............
Traceback (most recent call last):
File "C:\Python\tabl a.py", line 929, in -toplevel-
tablesDirectory = tablesDirectory Prefix + os.environ['REMOTE_ADDR']
File "C:\Python23\li b\os.py", line 417, in __getitem__
return self.data[key.upper()]
KeyError: 'REMOTE_ADDR'
............... ...........


That tabla.py of yours is certainly to be executed in a CGI environment. So
call it that way - or provide the neccessary environment by stuffing values
to os.environ
--
Regards,

Diez B. Roggisch
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1614
by: Norman Shelley | last post by:
Is there a way to get at the object one is trying to access with a key to list out all the possible keys? See the except clause below. #!/usr/bin/env python2.2 from inspect import * import sys program = """ abc = {}
3
5096
by: Rune Strand | last post by:
I'm experiencing strange errors both with pickle and cPickle in the below code: import cPickle as pickle #import pickle from string import ascii_uppercase from string import ascii_lowercase def createData():
4
8044
by: homepricemaps | last post by:
i have an href which looks like this: <td class="all"> <a class="btn" name="D1" href="http://www.cnn.com"> </a> here is my code
0
1893
by: John Salerno | last post by:
I'm trying to use a for loop with a FieldStorage object and I get the following error. Can you not treat it like a dictionary, or am I writing the for loop incorrectly? for item in form: print item # or print item.value
3
3967
by: nyenyec | last post by:
urllib.quote chokes on unicode in 2.4.4. 2.4.4 (#1, Oct 18 2006, 10:34:39) Traceback (most recent call last): File "<stdin>", line 1, in ? File "/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/urllib.py", line 1117, in quote res = map(safe_map.__getitem__, s)
5
1502
by: rconradharris | last post by:
A co-worker of mine came across some interesting behavior in the Python interpreter today and I'm hoping someone more knowledgeable in Python internals can explain this to me. First, we create an instance of an Old-Style class without defining a __contains__ but instead define a __getitem__ method in which we raise KeyError. Next we repeatedly use the 'in' operator to test to see whether something, a string, an int, etc is an attribute...
3
12857
GTXY20
by: GTXY20 | last post by:
Hello, Any comments on the below mentioned problem are most appreciated. I have a function and it is throwing this error: FEXpython_v2.py", line 32, in UnitHolderDistributionqty count+=1 KeyError: 3
2
7837
by: christof | last post by:
Hi, I am using pickle/unpickle to let my program save its documents to disk. While this it worked stable for a long time, one of my users now complained, that he had a file which can't be loaded. The traceback is: File "pickle.pyo", line 1374, in loads File "pickle.pyo", line 858, in load
6
55548
by: josh001 | last post by:
I'm trying to figure out why KeyError: 0 pops up when I try to run the program containing the code. OpenDLG = wx.FileDialog( self.win, message='Please choose the quiz or quizes that you wish to use.', defaultDir=os.getcwd(), defaultFile='',
0
8399
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8312
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8827
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8504
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8606
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7337
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.