Closed robertcontois closed 3 years ago
Related to #26
Did your scan finish or are you still scanning?
I don't see the notification that says "Scan completed" after pressing the button to scan, but the job shows in the admin area as having found 3 photos (the correct amount) and having a duration of a few seconds. This behavior of not being able to view the photo occurs in the demo site as well.
I've only been testing with 3 photos and it was working fine (I could view the photo) up until I updated dev commits from the past couple days or so into my fork.
Okay. It tries to read image.embedding which is calculated in image._im2vec() but it returns none. Did your scan crash once?
I updated my error message above to include all of the lines from when the backend starts. It's a fresh install, empty database, new build. There are no error messages on the backend logs to indicate the build crashes.
Could you look into your ownphotos.log in your log folder? Maybe there are more errors.
I figured out part of the problem, if you reuse the same _librephotosmedia folder with thumbnails already in it, the process for adding the new images crashes. I would expect that thumbnails would be overwritten if importing a new file with the same hash but it looks like that might not be the case. There's a lot of noise in my ownphotos.log, I'll try to post a clean version just with this issue.
Here is my ownphotos.log
2021-01-08 15:53:18,645 : directory_watcher.py : handle_new_image : 48 : INFO : job e08b1a05-a8dc-4ac5-9449-8e59f98fa004: handling image /data/IMG_3136.JPG 2021-01-08 15:53:18,662 : directory_watcher.py : handle_new_image : 90 : ERROR : job e08b1a05-a8dc-4ac5-9449-8e59f98fa004: could not load image /data/IMG_3136.JPG. reason: The 'thumbnail_big' attribute has no file associated with it. Traceback (most recent call last): File "/code/api/directory_watcher.py", line 70, in handle_new_image photo._generate_captions() File "/code/api/models.py", line 185, in _generate_captions image_path = self.thumbnail_big.path File "/miniconda/lib/python3.8/site-packages/django/db/models/fields/files.py", line 56, in path self._require_file() File "/miniconda/lib/python3.8/site-packages/django/db/models/fields/files.py", line 38, in _require_file raise ValueError("The '%s' attribute has no file associated with it." % self.field.name) ValueError: The 'thumbnail_big' attribute has no file associated with it. 2021-01-08 15:53:18,671 : directory_watcher.py : handle_new_image : 48 : INFO : job e08b1a05-a8dc-4ac5-9449-8e59f98fa004: handling image /data/sample1.jpg 2021-01-08 15:53:18,677 : directory_watcher.py : handle_new_image : 90 : ERROR : job e08b1a05-a8dc-4ac5-9449-8e59f98fa004: could not load image /data/sample1.jpg. reason: The 'thumbnail_big' attribute has no file associated with it. Traceback (most recent call last): File "/code/api/directory_watcher.py", line 70, in handle_new_image photo._generate_captions() File "/code/api/models.py", line 185, in _generate_captions image_path = self.thumbnail_big.path File "/miniconda/lib/python3.8/site-packages/django/db/models/fields/files.py", line 56, in path self._require_file() File "/miniconda/lib/python3.8/site-packages/django/db/models/fields/files.py", line 38, in _require_file raise ValueError("The '%s' attribute has no file associated with it." % self.field.name) ValueError: The 'thumbnail_big' attribute has no file associated with it. 2021-01-08 15:53:18,679 : directory_watcher.py : handle_new_image : 48 : INFO : job e08b1a05-a8dc-4ac5-9449-8e59f98fa004: handling image /data/sample4.jpg 2021-01-08 15:53:18,684 : directory_watcher.py : handle_new_image : 90 : ERROR : job e08b1a05-a8dc-4ac5-9449-8e59f98fa004: could not load image /data/sample4.jpg. reason: The 'thumbnail_big' attribute has no file associated with it. Traceback (most recent call last): File "/code/api/directory_watcher.py", line 70, in handle_new_image photo._generate_captions() File "/code/api/models.py", line 185, in _generate_captions image_path = self.thumbnail_big.path File "/miniconda/lib/python3.8/site-packages/django/db/models/fields/files.py", line 56, in path self._require_file() File "/miniconda/lib/python3.8/site-packages/django/db/models/fields/files.py", line 38, in _require_file raise ValueError("The '%s' attribute has no file associated with it." % self.field.name) ValueError: The 'thumbnail_big' attribute has no file associated with it. 2021-01-08 15:53:18,685 : directory_watcher.py : scan_photos : 169 : INFO : Added 4 photos 2021-01-08 15:53:18,686 : image_similarity.py : build_image_similarity_index : 28 : INFO : builing similarity index for user admin
This is the function in question. I don't generate a thumbnail, if there is already a thumbnail, which is correct. But I should add an association to the thumbnail if there is no thumbnail saved yet: https://github.com/LibrePhotos/librephotos/blob/42f5ebc4f286e3da0bcadfc05004622b46ec3f29/api/models.py#L274-L306
When clicking on a photo to view, the lightbox should open showing the larger version of the photo. The front end makes a call to /api/photos/aadd85dc9c9c91dd65d319a806b94a7b1/ and returns a 500 error and the lightbox sits waiting to load the image.
The following error is displayed in the backend log: