Forums

OSError: [Errno 2] No such file or directory

Hello everyone,

my website was working fine until 9am. Now when I try to access the website it displays Unhandled Exception. Here are the error log and the server log:

Error log:

2013-06-24 12:58:12,278 :Traceback (most recent call last):
2013-06-24 12:58:12,279 :OSError: [Errno 2] No such file or directory

Server log:

Traceback (most recent call last): False
File "/bin/user_wsgi_wrapper.py", line 58, in __call__ False
app_iterator = self.app(environ, start_response) True
File "/bin/user_wsgi_wrapper.py", line 70, in import_error_application False
raise e True
OSError: [Errno 2] No such file or directory False

Any ideias? I did not changed anything...

Thanks,

Danilo

Looks like it's working now. We had a database server glitch that didn't look like it had affected anyone, but it looks like it meant that the environment for your web app wasn't completely built. When I forced a rebuild, it started working again. Was 9am this morning the first time you'd hit the web app for a while? Like maybe since last week?

It is working now. How do i force a rebuild? I have a similar app in this same account that is still catching Unhandled Exception.

The last time I checked my app was last night.

Thank you for the reply.

[EDIT] Forget it, I reloaded and its up again. Thanks

Hi Python Anywhere Team,

I'm with the same problem reported in this topic on my website. It was working fine three hours ago, but now display the same errors described here.

How can I solve this problem?

Investigating...

My best guess is that there was a problem with your virtualenv, probably linked to our recent move to Ubuntu.

I've re-created a new virtualenv for you, and installed Django into it. I've also saved a requirements.txt for you in your app's folder. I think things are working again, will you check?

For anybody else having problems like this -- OSError, or problems with imports -- one thing to try is rebuilding a new virtualenv.

I have the same problem. Please fix as soon as possible. I'm not using virtualenv.

It's fixed. Sorry about that; we're investigating the underlying cause.

Same problem here for both my sites. I'm rebuilding one virtualenv now, but the second one is old - I can't remember how I set it up or what I put in it, and I don't have time at the moment to quibble about trying to remember.

Is it likely this will start working again as you fix your side, or is that site down for the foreseeable?

Oh, and in fact the first site is still not working after I rebuilt the virtualenv.

This is very bad timing.

Really sorry to hear that. We're investigating.

OK, we have them both working again now. I'll post back here in a minute with an explanation of what's going on and what we're doing to fix it.

OK, so here's what's going on. There was a problem with a number of virtualenvs, but we think that's actually mostly fixed now. This is a new problem.

As part of our move to Ubuntu we changed the way that we construct the "sandboxed" private filesystems where your web applications live. The new way is significantly, faster, more scalable and generally much better, but it's showed up a problem in our code.

When we start up a web app, we need to put together its sandbox if there isn't one already. The code that checks whether the sandbox is there already just looks for /bin/ls inside it -- if it's there then we assume that the sandbox is all set up, whereas if it's not then we rebuild the sandbox.

The problem is that our new system for building sandboxes can leave things in a state where the sandbox isn't fully constructed, but /bin/ls is present. So we're incorrectly skipping the build steps when that happens.

I'm going to run some code to manually force-rebuild all sandboxes for running webapps now, which will make sure that no-one is stuck in this situation. And we'll run that script regularly until we have a proper fix in -- the proper fix, of course, being to change our code that checks for the sandbox's existence so that it checks things more thoroughly before deciding to skip stuff.

I would suggest creating a /.incomplete file at the start of the process and only removing it once the process has definitively completed - if the first step in the process is copying from some sort of template, you could include the file in the template to be deleted later. Therefore, the absence of such a file is a pretty good indicator that the sandbox is complete. You could even use this file to log diagnostic info about the creation process so you can home in on which stage of the process failed. I'd suggest a timestamp at the start of the process and timestamped entries at key points - I've found this sort of thing helpful to detect things hanging up in the past (e.g DNS lookups that needed timeouts, etc.).

You could, of course, use the existence (as opposed to absence) of a file to indicate that the sandbox is complete, but personally I think the first alternative is cleaner because it doesn't leave anything in the sandbox after completion.

Thanks for the fix. My apologies for being a bit curt earlier.

@Cartroo -- apologies, I was oversimplifying earlier. Certain very specific circumstances (resulting from a failover/fail-back) can leave sandboxes in a state where a build has run to completion but certain bits are still missing. So I think the best we can do is simply do a "has this been done already?" check for every step of the creation process, re-doing every step that needs it, so that they get patched up.

@evilkillerfiggin not a problem at all, I entirely understand.

Again "Unhandled Exception".

Before it was:

2013-07-10 02:41:28,370: IOError: write error

2013-07-10 02:41:28,563: RuntimeError: generator ignored GeneratorExit

Now everything is OK, thx.

Can you get your app to provide a more detailed traceback? it might help with debugging...

@harry... send feedback.

Have replied to @Wasser, but here is a generic answer, in case anyone else is wondering about IOErrors or RuntimeErrors with no traceback.

Normal errors in the error log have a full traceback. Example:

2013-07-11 13:52:41,541 :Internal Server Error: /whatever/url
Traceback (most recent call last):
  File "/home/someone/.virtualenvs/django/lib/python2.7/site-packages/django/core/handlers/base.py", line 115, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/home/someone/myproject/myapp/views.py", line 14, in my_view
    do_something_bad_that_might_raise_an_error()
OhNoesException: something is broken

These can help you identify potential bugs in your code

The second type of error is more mysterious, because it has no traceback. Example:

2013-07-11 13:58:58,617 :IOError: write error
2013-07-11 13:58:58,618 :RuntimeError: generator ignored GeneratorExit

This suggests that it is less likely to be a bug in your code, but more likely some kind of low-level error. If you then have a look at your server log file, /var/log/www.my-domain.com.server.log, you will see many errors that look like this:

SIGPIPE: writing to a closed pipe/socket/fd (probably the client disconnected) on request / (ip 101.101.101.101) !!!
uwsgi_response_write_headers_do(): Broken pipe [core/writer.c line 193]
IOError: write error False
RuntimeError: generator ignored GeneratorExit False

As far as we can tell these errors are harmless. Here's a discussion from the uwsgi mailing list

The server log comes from your uWSGI workers, which are the ones actually talking to the outside world, and asking your code to respond to requests. They are saying that they sometimes get disconnected from the client half-way through sending a response, and then that causes an error that appears in your error log. This isn't a problem that you can fix, but also it is probably not one you need to worry about. Sometimes, clients disconnect, that is something that happens every day. uWSGI is just a bit over-enthusiastic about logging this. There is an option to switch off SIGPIPE logging in uWSGI which we will investigate.

Again "Unhandled Exception" = "OSError: [Errno 2] No such file or directory".

Now works, thx

Thanks for confirming. We've just released a new version of PythonAnywhere which should be more reliable than the last. And we're working hard on a much better version which we'll get our as soon as possible -- if all goes well, next week,

Hi Am getting OSError as well... My URL: http://ulmastersproject.pythonanywhere.com/

Kindly resolve this issue !!

Thanks, San

Hi - I am also still getting the OSError

Mine is working now

Just for completeness -- this was fixed last night, here's the explanation I just posted on a different thread.

Greetings. Again, the problem arose, as in the first post :(

Investigating...

Looks like it was a temporary glitch? Things seem OK now? I will take a look through the logs and see if I can find any evidence of what happened...

Kind of like a yes. But "karting51" = did not work, "summonersrift" = earned.

Now everything is OK, thx.

Hi, I have the same problem with my Flask application: OSError: [Errno 2] No such file or directory False Traceback (most recent call last): False File "/bin/user_wsgi_wrapper.py", line 58, in call False app_iterator = self.app(environ, start_response) True File "/bin/user_wsgi_wrapper.py", line 70, in import_error_application False raise e True

Could you please check it.

Ok, I've found the solution. "/ > var > www > palagrassi_pythonanywhere_com_wsgi.py" I've replaced the app hosting reference file from this : from run import app as application to this : from app import app as application

Greetings. Again, the problem has begun, as in the first post :( From the error.log it started with 24.08.2013 02:59:49,762

Sorry about that. It looks like it was a database problem again; Amazon had some issues early this morning and it looks like it caused the same problem for you again. I've fixed it and your web apps should be OK now.

Yes... everything works. Why am I so unlucky.

It is strange that your account seems to be particularly affected by this bug. I can't see anything unusual about it. One thing that might help if it happens again is to hit the "Reload" button for the web app that's been affected.

We think we have an handle on one possible cause of the problem, anyway, and the code to do that is currently working through our testing cycle before release next week. Let's see if that helps.

"Reload" I pressed more than once... It does not help :(

OK, thanks for letting us know that. I think we're pretty sure on the cause of this problem -- but the fact that you in particular are getting affected so much is still a mystery. I would expect the problem to affect more people. Odd.

Hello,

My bottle website was working fine but now I'm getting the OSError: [Errno 2] No such file or directory. It seems that the error happens when importing matplotlib. Commenting the "import matplotlib" line in the following minimal code solves the problem.

from bottle import default_app, route

import matplotlib

@route('/')
def server_static():
    return 'hello'

application = default_app()

What should I do ?

Thanks, Jerome

I tried that code and it works fine. Try doing the import in a route so the actual exception gets dumped into your server log.

Here's a dump of the server log :

2013-09-01 16:59:36,676 :    import matplotlib 
2013-09-01 16:59:36,676 :  File "/usr/local/lib/python2.7/dist-packages/matplotlib/__init__.py", line 838, in <module>
2013-09-01 16:59:36,676 :    rcParams = rc_params()
2013-09-01 16:59:36,677 :  File "/usr/local/lib/python2.7/dist-packages/matplotlib/__init__.py", line 749, in rc_params
2013-09-01 16:59:36,677 :    fname = matplotlib_fname()
2013-09-01 16:59:36,677 :  File "/usr/local/lib/python2.7/dist-packages/matplotlib/__init__.py", line 630, in matplotlib_fname
2013-09-01 16:59:36,677 :    oldname = os.path.join( os.getcwd(), '.matplotlibrc')
2013-09-01 16:59:36,677 :OSError: [Errno 2] No such file or directory

The server log suggests that os.getcwd() is broken. The following code triggers the same error:

from bottle import default_app, route
import os

@route('/')
def server_static():
    print os.getcwd()
    return 'hello'

application = default_app()

Server log :

2013-09-01 19:20:34,132 :  File "/home/jesteve72/mysite/webapp.py", line 6, in server_static
2013-09-01 19:20:34,132 :    print os.getcwd()
2013-09-01 19:20:34,132 :OSError: [Errno 2] No such file or directory

Experiencing the same problem and from the logs it seems that the error has been going on for hours. A reload didn't fix the problem.

Hi, It seems I have the same problem on nocesdor.pythonanywhere.com

You said to rebuild my virtualenv, but I'm a bit scared to do something wrong and forget half of what's needed. I'm a beginner! Can you help me or release a precise Tutorial? Sorry if it is a really dumb request!

Thanks

ps: The reload did not fix the problem but instead of the Unhandled exception, I now have the 502 gateway problem.

Again this "Unhandled exception". Everything was fine yesterday. Today woke up and friends write about this issue. It all started with reports 09.02.2013 00:16:34,953 = error.log

Any help? This "Unhandled exception" error is popping up again.

OSError: [Errno 2] No such file or directory False Traceback (most recent call last): False File "/bin/user_wsgi_wrapper.py", line 58, in call False app_iterator = self.app(environ, start_response) True File "/bin/user_wsgi_wrapper.py", line 70, in import_error_application False raise e True OSError: [Errno 2] No such file or directory False

Hi, today I also had an OSError when importing matplotlib. I removed the "import matplotlib" from my files, but I amb still geting an OSError: [Errno2] No such file or directory Exception Location: "/usr/local/lib/python2.7/dist-packages/django/utils/_os.py" in abspathu, line 22 Python Executable: "/usr/local/bin/uwsgi" thanks

I've got the same error. What's happening?

Hi everyone -- sorry for the delayed response. It looks like a rogue backup process last night caused problems for some web apps. We've rebuilt the affected system and it looks like everything's OK now. Let us know if there's anything still not working.

We've disabled the backup system that was causing the problem for the time being, so it shouldn't happen again.

It's working again. Thank you so much! You've been great!

Hi!

I got a similar problem.

Whenever I try to use bottle.template(..), I get the following error:

OSError(2, 'No such file or directory')

Also, the error doesn't occur if I don't use 'bottle.template(..)`

Please help.

server.log Traceback (most recent call last): False File "/bin/user_wsgi_wrapper.py", line 58, in call False app_iterator = self.app(environ, start_response) True File "/bin/user_wsgi_wrapper.py", line 70, in import_error_application False raise e True OSError: [Errno 2] No such file or directory False

Please help.

My stuff all failed about that time with Input/Output errors - seems OK now.

We had an outage when one of the web servers lost its connection to one of the file servers. The outage lasted about half an hour and everything seems to be OK now. I have the logs from before, during and after the outage and we'll study them tomorrow to see what we can do about this sort of failure in future.

I have a similar error. My app worked fine yesterday night and this morning I found the "Unhandled exeption" on the site.

On the error log it first raised this exception: ValueError: Unable to configure filter 'require_debug_false': Cannot resolve 'django.utils.log.RequireDebugFalse': No module named RequireDebugFalse

And then it just says: OSError: [Errno 2] No such file or directory

Please help

@gimiweb I think glenn's post explains what happened?

Jim

Yes, thanks, It works now!

It doesn't work for me despite several reloads, I have

:OSError: [Errno 2] No such file or directory

in the logs too.

Unhandled Exception again :(

Same symptoms here, Unhandled Exception and

2013-09-29 12:55:35,055 :OSError: [Errno 2] No such file or directory

in the error log.

Same for me, Unhandled Exception and

2013-09-29 13:25:47,998 :Traceback (most recent call last): 2013-09-29 13:25:47,998 :OSError: [Errno 2] No such file or directory

It's like that since more than a hour, and nothing change.

Is there a solution?

i am facing the same issue!!!!! what is the root cause of it?pls help to fix it ASAP!!!

it seems an issue of pythonanywhere, is there anyone working on it? i just paid 5$!

hi Hi Python Anywhere Team, R U in sleep?

Sorry, looks like our alerting system is broken -- we weren't paged about this. Investigating now.

The problem was a different web server, so a different set of people were affected -- looks like the monitoring for that one was broken too, which is why we weren't alerted. I've rebooted the server and everything looks OK now.

Thank you very much

Thank you :)