-
-
Notifications
You must be signed in to change notification settings - Fork 893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Socket.io not working on my machine #807
Comments
Python 2 or Python 3? If you Google this issue, some people reported this error with Python 2, but the problem was address in Python 3, so maybe give 3 a try if you are using 2. Also things may change if you change your async mode. Do you currently have eventlet or gevent installed on your virtualenv? If not, try installing eventlet, that will give you the benefit of having WebSocket support, and will use a different web server, which may help bypass the issue. If you are getting this error with eventlet installed, then try gevent instead, once again, it's a different web server, so you may have better luck. |
python 3.6.4 (anaconda)
update: but i dont know what to do should i remove anaconda and install python ? |
I'm not sure. It's been a while since I've used the native version of Python on Windows, on that platform I use either the Ubuntu subsystem or Cygwin, and both seem very stable. I'll find a Windows machine to test again and let you know. As one more test you may want to try the example application in this repository, just to rule out a problem in your own application. |
honstly i dont know how to use the repository
i appraciate your help alot i just wanna say that |
Okay, I'll look for a Windows machine to test this on and get back to you. |
thank you so much !!
i appreciate your effort sir , thanks a lot |
What's the output of the |
alabaster==0.7.11 |
what should i do ? |
As I said above, if you were willing to switch to the Ubuntu subsystem on your Windows machine, or maybe install Cygwin, then everything will work fine, because these two use a Unix build of Python. If you prefer to stay with your current Windows native Python, then I'm not sure. This problem is mentioned a lot if you Google it. If the application works well in spite of the error, then maybe it is okay to ignore it. |
i have installed Cygwin and thatis what happen when i run project 1 which have no Socket io D:\Work\study\project1>flask run
when i ran project 2 now it shows an error ( which socketIO ): D:\Work\study\project2org\project2>flask run
|
The second error means that you have some other application that was recently running on the same port. After a few minutes the port will be free and you will be able to use it. You can try using a different port number if you don't want to wait. |
yea i got it i closed it the other server running on cmd and it worked |
Mena@Mena-PC /cygdrive/d/work/study/project2org/project2 Error: Could not locate a Flask application. You did not provide the "FLASK_APP" environment variable, and a "wsgi.py" or "app.py" module was not found in the current directory.
Mena@Mena-PC /cygdrive/d/work/study/project2org/project2 |
The error is self-explanatory. Set the |
Mena@Mena-PC /cygdrive/d/work/study/project2org/project2 Mena@Mena-PC /cygdrive/d/work/study/project2org/project2 Error: Could not locate a Flask application. You did not provide the "FLASK_APP" environment variable, and a "wsgi.py" or "app.py" module was not found in the current directory.
|
i know i already did |
Mena@Mena-PC /cygdrive/d/work/study/project2org/project2 Mena@Mena-PC /cygdrive/d/work/study/project2org/project2 nothing happen for a while now ( around 1 min )
|
should i run it on windows safe mode ?? |
iam so tired of trying just to get it to work :S |
You seem to be having very basic set up problems, more related to Flask than Flask-SocketIO. Unfortunately I cannot help you with details, as aI do not know how your application is structured. If you have the app somewhere I can look at it I can give you some more advice, but really this should not take so much time, you have to point Flask at the application. I should mention that in the Windows native case, you should use |
dude literally that is all i have in the code which everyone in my course have it as well but no one with this problem :S when it run with cgywin >>>>
when i try it with CMD >>>>>
it say server is running on 127.0.0.1:5000 if the code doesnt have socket io in it , if it does it only says what i have mentioned above and yes when i visit 127.0.0.1:5000 i see it working but abslout silence if i tried to send anything from socket io i had a different version as well , no errors at all , it prints anything related to python but none from socket io |
also when i used inspector tool by chrome and checked the network tab i can see few socket io data moves but within few mins later i get this error i have mentioned above ( that was on windows 10 )
|
here some videos from my pc to administrate what happen exactly |
None of the zip files you attached on this issue are valid.
|
it was winrar but the system doesn't allow me to upload winrar |
here are the videos >>>>
|
The problem with The other problem I said I will investigate once I have access to a Windows machine. Cygwin or the Ubuntu subsystem will (I think) not have have that problem. On the Windows version you may get it to work if you uninstall gevent (I suspect an incompatibility with gevent, but this is just a hunch). |
i don't have gevent installed currently , and i have tested Cygwin , same reaction , it never prints "Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)" basically ignor anything related to socket io |
Pretty sure you have either gevent or eventlet installed. The output would be different if you hadn't. Here is another thing for you to try, in any case. Add the following at the bottom of application.py: if __name__ == '__main__':
socketio.run(app) Then start the application by running:
Does that work better? There is a bug in Flask related to the |
i did that .. which is responding to
|
hey i uninstalled socketio and tried to reinstall it again i got this
|
It's |
i managed to install both socketio and eventlet |
anyway i can trace where is this problem coming from ? .. any logging or anything ? |
Sorry, but I am very confused. What do you mean by "same thing happen"? You already reported five or six different outcomes, how am I supposed to know which one you are referring to? Does the server work or not? |
i'm sorry as i've mentioned earlier i'm googleing and trying different thing just to help us figure it out now i tried to run the code after the fresh installation i got the same result
|
I believe I told you several times that I need to investigate why this happens when I have access to a Windows machine. There is nothing I can do right now. On the other side, I suggested you try something else that you apparently have ignored: #807 (comment). |
@miguelgrinberg i'm trying other things to get socket Io to work i'm not ignoring it sir. |
it would help if there is a way to read loggin from my machine about socket io |
Logging options are documented: https://flask-socketio.readthedocs.io/en/latest/#flask_socketio.SocketIO. This is not going to help you though, your application is hanging before the web server or Socket.IO get a chance to start. |
then maybe logging for python or flask can provide us with a clue of where the smoke is coming from ? |
i have the same problem, it because i install wrong package |
I'm new in developing and Flask I had 2 projects during my course , the error occurs in the second one only and only when socket.io exist , it's an empty project but Flask behaves very weird.
for example, every time I run Flask without socket IO it reads something like this
in project 2 we had to work with socket.io and I know it's the reason because I deleted its line and the weird behavior were gone , also no errors when I ran the socket IO application I get
that is it after a while I get
with that said here is my simple python code
index html file
tested it with chrome and Firefox
The text was updated successfully, but these errors were encountered: