[Django] #23691: devserver autoreload: OSError: [Errno 2] No such file or directory

29 views
Skip to first unread message

Django

unread,
Oct 20, 2014, 10:51:38 AM10/20/14
to django-...@googlegroups.com
#23691: devserver autoreload: OSError: [Errno 2] No such file or directory
-------------------------------------+-------------------------------------
Reporter: sergei-maertens | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (Management | Version: 1.7
commands) | Keywords: development server,
Severity: Normal | autoreload
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
I'm running into an issue with the autoreload from the dev server (might
be related to #23083).

Python version: 2.7.8
Virtualenv (with virtualenvwrapper), version 1.11.6
Django 1.7.0
OS: Arch Linux

Usually I run the development server from the directory containing
manage.py by invoking ./manage.py runserver.

This leads to the attached stacktrace. When I run it by using the absolute
path to the file, it's fine.

Upon further investigation I noticed that at the end of manage.py
os.getcwd() prints the expected cwd, but at the point where the exception
occurs Python/Django seems to think I'm in my virtualenv directory.

Expected cwd: /home/bbt/coding/maykin/leesrijk/src/
Virtualenv location: /home/bbt/coding/.virtualenvs/leesrijk/
Reported cwd in reload.py: /home/bbt/coding/.virtualenvs/leesrijk

I'm not sure if this is a Django bug or if something else is going on, but
it started happening with Django 1.7, no issues on 1.6.

--
Ticket URL: <https://code.djangoproject.com/ticket/23691>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 20, 2014, 11:05:23 AM10/20/14
to django-...@googlegroups.com
#23691: devserver autoreload: OSError: [Errno 2] No such file or directory
-------------------------------------+-------------------------------------
Reporter: sergei-maertens | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (Management | Version: 1.7
commands) | Resolution:
Severity: Normal | Triage Stage:
Keywords: development server, | Unreviewed
autoreload | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by bmispelon):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

Hi,

I have the same OS, the same Python and virtualenv versions yet I can't
seem to reproduce your issue:
{{{
$ python2 --version
Python 2.7.8

$ virtualenv --version
1.11.6

$ mkvirtualenv -p /usr/bin/python2 djangobug23691
Running virtualenv with interpreter /usr/bin/python2
New python executable in djangobug23691/bin/python2
Also creating executable in djangobug23691/bin/python
Installing setuptools, pip...done.

(djangobug23691)$ pip install Django==1.7.0
Downloading/unpacking Django==1.7.0
Downloading Django-1.7-py2.py3-none-any.whl (7.4MB): 7.4MB downloaded
Installing collected packages: Django
Successfully installed Django
Cleaning up...

(djangobug23691)$ django-admin startproject djangobug23691
(djangobug23691)$ cd djangobug23691/
(djangobug23691)$ ./manage.py migrate
Operations to perform:
Apply all migrations: admin, contenttypes, auth, sessions
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying sessions.0001_initial... OK

(djangobug23691)$ ./manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).
October 20, 2014 - 15:03:14
Django version 1.7, using settings 'djangobug23691.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[20/Oct/2014 15:03:16] "GET / HTTP/1.1" 200 1759
}}}

Am I missing something?

--
Ticket URL: <https://code.djangoproject.com/ticket/23691#comment:1>

Django

unread,
Oct 20, 2014, 11:29:44 AM10/20/14
to django-...@googlegroups.com
#23691: devserver autoreload: OSError: [Errno 2] No such file or directory
-------------------------------------+-------------------------------------
Reporter: sergei-maertens | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (Management | Version: 1.7
commands) | Resolution:
Severity: Normal | Triage Stage:
Keywords: development server, | Unreviewed
autoreload | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by sergei-maertens):

I'm not sure, colleagues running Debian/Windows report no issues either.
I'm attaching the output from pip freeze, maybe it's related to some
library there.

--
Ticket URL: <https://code.djangoproject.com/ticket/23691#comment:2>

Django

unread,
Oct 20, 2014, 10:42:01 PM10/20/14
to django-...@googlegroups.com
#23691: devserver autoreload: OSError: [Errno 2] No such file or directory
-------------------------------------+-------------------------------------
Reporter: sergei-maertens | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (Management | Version: 1.7
commands) | Resolution:
Severity: Normal | Triage Stage:
Keywords: development server, | Unreviewed
autoreload | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by collinanderson):

Right, so based on your stacktrace, it seems like _something_ is changing
the current working directory. Assuming that's true, maybe the runserver
code needs to run abspath on everything it finds? Either that or we need
to not support changing the current working directory once django is
loaded.

--
Ticket URL: <https://code.djangoproject.com/ticket/23691#comment:3>

Django

unread,
Oct 21, 2014, 4:17:31 AM10/21/14
to django-...@googlegroups.com
#23691: devserver autoreload: OSError: [Errno 2] No such file or directory
-------------------------------------+-------------------------------------
Reporter: sergei-maertens | Owner: nobody
Type: Uncategorized | Status: closed

Component: Core (Management | Version: 1.7
commands) | Resolution: invalid

Severity: Normal | Triage Stage:
Keywords: development server, | Unreviewed
autoreload | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by sergei-maertens):

* status: new => closed
* resolution: => invalid


Comment:

I recently changed to zsh instead of bash and running it in bash looks
fine, so there's probably something weird going on in my zsh config. So
since this is probably not a django issue, I'm leaving it for what it is.

--
Ticket URL: <https://code.djangoproject.com/ticket/23691#comment:4>

Django

unread,
Oct 21, 2014, 6:03:16 AM10/21/14
to django-...@googlegroups.com
#23691: devserver autoreload: OSError: [Errno 2] No such file or directory
-------------------------------------+-------------------------------------
Reporter: sergei-maertens | Owner: nobody
Type: Uncategorized | Status: closed

Component: Core (Management | Version: 1.7
commands) | Resolution: invalid
Severity: Normal | Triage Stage:
Keywords: development server, | Unreviewed
autoreload | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by sergei-maertens):

I managed to track the point of cwd change, it happens in
django.utils.autoreload.clean_files, but it seems to be a random point.
It's never for the same file. Could this be related to the threading in
the dev server?

--
Ticket URL: <https://code.djangoproject.com/ticket/23691#comment:5>

Django

unread,
Nov 3, 2014, 9:46:44 AM11/3/14
to django-...@googlegroups.com
#23691: devserver autoreload: OSError: [Errno 2] No such file or directory
-------------------------------------+-------------------------------------
Reporter: sergei-maertens | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (Management | Version: 1.7
commands) | Resolution:

Severity: Normal | Triage Stage:
Keywords: development server, | Unreviewed
autoreload | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by sergei-maertens):

* status: closed => new
* resolution: invalid =>


Comment:

Reopening this ticket since a colleague runs into the same issue

OS: Ubuntu 14.10, fresh install as of today
Python version: 2.7.6
Django version: 1.7

Startproject template: https://bitbucket.org/maykinmedia/default-project

--
Ticket URL: <https://code.djangoproject.com/ticket/23691#comment:6>

Django

unread,
Nov 4, 2014, 2:10:58 PM11/4/14
to django-...@googlegroups.com
#23691: devserver autoreload: OSError: [Errno 2] No such file or directory
-------------------------------------+-------------------------------------
Reporter: sergei-maertens | Owner: nobody
Type: Uncategorized | Status: closed

Component: Core (Management | Version: 1.7
commands) | Resolution: needsinfo

Severity: Normal | Triage Stage:
Keywords: development server, | Unreviewed
autoreload | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by timgraham):

* status: new => closed

* resolution: => needsinfo


Comment:

I think we'll need more details in order to reproduce and debug the issue.

--
Ticket URL: <https://code.djangoproject.com/ticket/23691#comment:7>

Django

unread,
Nov 8, 2014, 5:28:26 PM11/8/14
to django-...@googlegroups.com
#23691: devserver autoreload: OSError: [Errno 2] No such file or directory
-------------------------------------+-------------------------------------
Reporter: sergei-maertens | Owner: nobody
Type: Uncategorized | Status: closed

Component: Core (Management | Version: 1.7
commands) | Resolution: needsinfo
Severity: Normal | Triage Stage:
Keywords: development server, | Unreviewed
autoreload | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by sergei-maertens):

Sure, I have a feeling that it's related to the startproject template.
Hopefully I can investigate soon.

--
Ticket URL: <https://code.djangoproject.com/ticket/23691#comment:8>

Django

unread,
Apr 9, 2015, 1:50:24 PM4/9/15
to django-...@googlegroups.com
#23691: devserver autoreload: OSError: [Errno 2] No such file or directory
-------------------------------------+-------------------------------------
Reporter: sergei-maertens | Owner: nobody
Type: Uncategorized | Status: closed

Component: Core (Management | Version: 1.7
commands) |
Severity: Normal | Resolution: invalid
Keywords: development server, | Triage Stage:
autoreload | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by sergei-maertens):

* resolution: needsinfo => invalid


--
Ticket URL: <https://code.djangoproject.com/ticket/23691#comment:9>

Reply all
Reply to author
Forward
0 new messages