You are not logged in.
Pages: 1
Hi All
I installed all packages related to Flask and I wrote a code like this:
import flask
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return("Hello Arch forum, this is just flask test!")
if __name__ == "__main__":
app.run(debug = True)
When I run it in terminal:
.---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-2-b55dfd89ccfb> in <module>()
8
9 if __name__ == "__main__":
---> 10 app.run(debug = True)
/usr/lib/python3.5/site-packages/flask/app.py in run(self, host, port, debug, **options)
770 options.setdefault('use_debugger', self.debug)
771 try:
--> 772 run_simple(host, port, self, **options)
773 finally:
774 # reset the first request information if the development server
/usr/lib/python3.5/site-packages/werkzeug/serving.py in run_simple(hostname, port, application, use_reloader, use_debugger, use_evalex, extra_files, reloader_interval, reloader_type, threaded, processes, request_handler, static_files, passthrough_errors, ssl_context)
672 s = socket.socket(address_family, socket.SOCK_STREAM)
673 s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
--> 674 s.bind((hostname, port))
675 if hasattr(s, 'set_inheritable'):
676 s.set_inheritable(True)
OSError: [Errno 98] Address already in use
Why am I getting this Error? How should I fix it? if Flask is a Python web framework programming How should I see my codes in firefox?
Offline
Well, the error message says it :
OSError: [Errno 98] Address already in use
By default flaks listens to the 5000 port, you may want to check if you have a process listening at this address, and maybe kill it
You can install netstat from the net-tools package and then run something like:
sudo netstat --program --listening --numeric --tcp
Responsible Coder, Python Fan, Rust enthusiast
Offline
See output:
[hossein@ArchLinux ~]$ sudo netstat --program --listening --numeric --tcp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:60013 0.0.0.0:* LISTEN 9785/python3
tcp 0 0 127.0.0.1:46415 0.0.0.0:* LISTEN 9785/python3
tcp 0 0 127.0.0.1:40080 0.0.0.0:* LISTEN 9785/python3
tcp 0 0 127.0.0.1:43891 0.0.0.0:* LISTEN 9785/python3
tcp 0 0 127.0.0.1:8888 0.0.0.0:* LISTEN 854/python3
tcp 0 0 127.0.0.1:9050 0.0.0.0:* LISTEN 801/tor
tcp 0 0 127.0.0.1:49120 0.0.0.0:* LISTEN 9785/python3
tcp 0 0 127.0.0.1:41280 0.0.0.0:* LISTEN 804/python2
tcp 0 0 127.0.0.1:5000 0.0.0.0:* LISTEN 9785/python3
tcp 0 0 127.0.0.1:36460 0.0.0.0:* LISTEN 9785/python3
tcp6 0 0 ::1:8888 :::* LISTEN 854/python3
[hossein@ArchLinux ~]$
Python3 is using that port but still problem!
Offline
Python3 is using that port but still problem!
It is the problem your Flask application tries to tell you. Some other Python application already uses this port so your example above cannot use it.
Either find the application that already uses port 5000 and kill it or change your Flask app to use different port.
Read it before posting http://www.catb.org/esr/faqs/smart-questions.html
Ruby gems repository done right https://bbs.archlinux.org/viewtopic.php?id=182729
Fast initramfs generator with security in mind https://wiki.archlinux.org/index.php/Booster
Offline
Pages: 1