I am having trouble getting this script to work. My intent is to load images into the db in bulk from the filesystem.
http://pastebin.com/m40565da9 When I execute this, I get the following error: Traceback (most recent call last): File "load_images.py", line 16, in <module> GalleryImage.objects.create(image=file) File "/usr/lib/python2.5/site-packages/django/db/models/manager.py", line 99, in create return self.get_query_set().create(**kwargs) File "/usr/lib/python2.5/site-packages/django/db/models/query.py", line 352, in create obj.save(force_insert=True) File "/usr/lib/python2.5/site-packages/django/db/models/base.py", line 328, in save self.save_base(force_insert=force_insert, force_update=force_update) File "/usr/lib/python2.5/site-packages/django/db/models/base.py", line 388, in save_base values = [(f, f.get_db_prep_save(raw and getattr(self, f.attname) or f.pre_save(self, True))) for f in meta.local_fields if not isinstance(f, AutoField)] File "/usr/lib/python2.5/site-packages/django/db/models/fields/ files.py", line 187, in pre_save file.save(file.name, file, save=False) File "/usr/lib/python2.5/site-packages/django/db/models/fields/ files.py", line 235, in save self._dimensions_cache = get_image_dimensions(content) File "/usr/lib/python2.5/site-packages/django/core/files/images.py", line 36, in get_image_dimensions data = file.read(1024) File "/usr/lib/python2.5/site-packages/django/core/files/base.py", line 136, in read return self.file.read(num_bytes) File "/usr/lib/python2.5/site-packages/django/db/models/fields/ files.py", line 48, in _get_file self._file = self.storage.open(self.name, 'rb') File "/usr/lib/python2.5/site-packages/django/core/files/ storage.py", line 30, in open file = self._open(name, mode) File "/usr/lib/python2.5/site-packages/django/core/files/ storage.py", line 138, in _open return File(open(self.path(name), mode)) IOError: [Errno 2] No such file or directory: u'/media/PATRIOT/ djangosites/vandyke/site-media/loader-images/100_0056.jpg' It looks like it is trying to open the file before it has been initially written. Is this a bug? Or am I doing something wrong? Thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---