Closed jbogarin closed 6 years ago
Looks like this may have been corrected, as the current sample code repo shows an integer being provided: https://github.com/CiscoDevNet/devnet-express-cloud-collab-code-samples/blob/master/itp/collab-tools-visual-studio-code-ide-itp/flask-api.py
Can you try refreshing your sample code repo, and re-open this issue if you still see a problem?
@dstaudt I think I didn't make myself clear, right now the code says
default = os.getenv('PORT', 5000)
but when you define an environment variable, the environment variable is a string so that line fails.
The correct code should be:
default = int(os.getenv('PORT', 5000))
including the int before the os.getenv
Gotcha...I actually couldn't reproduce the problem as state on my system, however I made the change (committed) anyway as it should be more correct (new version also works on my system without issue.)
In the collab-tools-visual-studio-code-ide-itp and the related code in the flask-api.py, it needs an integer because that is what is expected by
app.run()
function.The recommended change is something like this:
Without that change, python returns the following error message: