Error: use os.getenv(PORT, 8080) as the port and os.getenv(IP,


First a greeting to the community.
My programming skills are very basic. I’m starting now.
I made a small program that works well, but is usually only stop almost constantly.
getting the error:
Important: use os.getenv (PORT, 8080) as the port and os.getenv (IP as the host in your scripts!
I looked at Google, etc, and not how to solve this problem.
You could help me or give me some advice.

Thank you


You need to put PORT, 8080 and IP into quotes like so:

os.getenv(‘PORT’, ‘8080’)
os.getenv(‘IP’, ‘’)



Thanks for the reply. I did as you suggested and placed those lines in my “py” file in the beginning. Now I get the following message when I press “Run”:

Traceback (most recent call last):
File “/home/ubuntu/workspace/”, line 1, in
os.getenv(‘PORT’, ‘8080’)
NameError: name ‘os’ is not defined

What would you suggest next? Thanks again!


A little too late, and i think you’ve found the answer but maybe i can help other people ^^
os.something means call the function ‘something’ in the module ‘os’ so you need to include the module ‘os’, else python cannot find the right function ^^
To do that you need to put the line ‘import os’ on top of your code :wink: