I am trying to run the simple below snippet
port = int(os.getenv('PORT'))
print("Starting app on port %d" % port)
I can understand the PORT is s string but I need to cast to a int. Why I am getting the error
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
export PORT
. Hence there's noPORT
in the env, hence it returnsNone
– Dusenos.getenv('PORT', default_port)
would work. – Kolb