Opened 13 years ago
Closed 12 years ago
#18196 closed Bug (fixed)
loaddata doesn't handle ImportError exception
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Core (Management commands) | Version: | 1.4 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Steps to reproduce:
- create a clean virtualenv
virtualenv virtual
- install django 1.4
pip install django==1.4
- create a project and app
- add wadofstuff (don't install it on the virtenv)
SERIALIZATION_MODULES = { 'json': 'wadofstuff.django.serializers.json' }
- run syncdb
Django will fail on line 123 of loaddata.py:
formats = serializers.get_public_serializer_formats()
with
*** ImportError: No module named wadofstuff.django.serializers.json
but will trough this error:
Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/home/nxvl/dev/repuesport/virtual/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line utility.execute() File "/home/nxvl/dev/repuesport/virtual/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/nxvl/dev/repuesport/virtual/local/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv self.execute(*args, **options.__dict__) File "/home/nxvl/dev/repuesport/virtual/local/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute output = self.handle(*args, **options) File "/home/nxvl/dev/repuesport/virtual/local/lib/python2.7/site-packages/django/core/management/base.py", line 371, in handle return self.handle_noargs(**options) File "/home/nxvl/dev/repuesport/virtual/local/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 164, in handle_noargs call_command('loaddata', 'initial_data', verbosity=verbosity, database=db) File "/home/nxvl/dev/repuesport/virtual/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 150, in call_command return klass.execute(*args, **defaults) File "/home/nxvl/dev/repuesport/virtual/local/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute output = self.handle(*args, **options) File "/home/nxvl/dev/repuesport/virtual/local/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 239, in handle (full_path, ''.join(traceback.format_exception(sys.exc_type, UnboundLocalError: local variable 'full_path' referenced before assignment
Issue is on the exception handler line 230.
Attachments (2)
Change History (6)
comment:1 by , 13 years ago
Triage Stage: | Unreviewed → Accepted |
---|
by , 13 years ago
Attachment: | 18196-1.diff added |
---|
comment:2 by , 13 years ago
Has patch: | set |
---|
comment:4 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
More precise exception catching