Skip to content

Websocket example: 400 error and ENOENT in send_file #191

Answered by miguelgrinberg
Jarshvor asked this question in Q&A
Discussion options

You must be logged in to vote

The ENOENT error is short for "no such file or directory". It means that the path that you are passing to send_file() does not represent a file that can be opened. To me it sounds like your application is confusing templates with static files. The send_file() function is used to send static files, but you have your index.html file in the templates directory.

The quick and dirty solution would be to change the send_file() call to send_file('templates/index.html'). This function does not have any notion of where files are stored, you have to give it an absolute or relative path to the file. As a general recommendation I would suggest that if your html file is not going to be a template that…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Jarshvor
Comment options

Answer selected by Jarshvor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants