peircej / jbrout

Automatically exported from code.google.com/p/jbrout
0 stars 0 forks source link

Import fails completely if there's a corrupted jpeg file. #141

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Put corrupted jpeg (attached in problematic.zip) to a folder with other
jpges
2. Add this folder in jBrout

What is the expected output? What do you see instead?

I would expect this image to be ignored or logged anywhere. I would also be
okay if i got the error, but it didn't stop the program from importing
other pictures.
Instead I get error and zero pictures imported.

Traceback (most recent call last):
   File "/usr/lib/jbrout/jbrout.py", line 2428, in on_btn_addFolder_clicked
    self.on_drop_folders_from_os(self.treeviewdb.get_model(),[folder])
   File "/usr/lib/jbrout/jbrout.py", line 1574, in on_drop_folders_from_os
    for nb in iterator:
   File "/usr/lib/jbrout/jbrout/db.py", line 128, in add
    self.__addPhoto( file ,tags,filesInBasket)
   File "/usr/lib/jbrout/jbrout/db.py", line 188, in __addPhoto
    raise err+"\nPhoto has incorrect exif/iptc tags, can't be imported
:\n"+str([file,])
 TypeError: exceptions must be classes or instances, not str

What version of the product are you using? On what operating system?

jbrout 0.3.174

Please provide any additional information below.

Ok, so this issue is driving me nuts right now. 

I have a 40 000+ photo collection that i made over years and when i try to
import it the program goes counting pictures and after about an hour it
brings me a 'corrupted image' message.. and zero pictures imported! I
believe some of my pictures were corrupted because of problems with hard
drive, and now i would just be fine if jBrout just imported all the good
pictures. Insted it doesn't even give a clue what picture was the problem
and it burns on my eyes as i try to browse through each folder trying to
figure which photos are faulty so i could remove them.

(oh yeah, and i wouldn't bother if jBrout wasn't that cool and had exactly
the features i dreamt about. Thanks author!)

Original issue reported on code.google.com by yur...@gmail.com on 9 Feb 2010 at 5:33

Attachments:

GoogleCodeExporter commented 8 years ago
I understand your trouble ...

but your "jpg" is not an image at all ...
it shouldn't ends with ".jpg"
it shouldn't be in yours folders labelled "photos"
and I'm pretty sure it's not produced by any real cam.

This trouble is as old as jbrout ...

but when this kind of error appears, it display a message box, with the uri of 
the 
file at the end of your message box ... helping you to spot the faulty 
"picture" in 
seconds.

if you use only real photos, or photos coming from a real cam : you should 
never see 
that trouble !
jbrout helps you to maintain a collection of "real photos" ...

Original comment by manat...@gmail.com on 9 Feb 2010 at 8:25

GoogleCodeExporter commented 8 years ago
As I said, some of my jpegs were corrupted. They WERE images, and now they are 
not.
It took me hours to scan all the folders to find and remove all corrupted 
images BY
HAND, looking them all through with my eyes, just because the program failed to 
give
me a useful feedback. It could at least register all the images it scanned 
before it
stumbled on the faulty one. Now it's been another couple of hours as jBrout is
scanning my images again and if didn't notice at least one corrupted image with 
my
human eyes, I'll have to start over, look through all the images to find the
corrupted jpeg, and run jBrout import again.
Oh, and as the copypaste above shows, the error didn't give me path to the 
faulty
picture :(

Using on Ubuntu Karmic. Thanks.

Original comment by yur...@gmail.com on 9 Feb 2010 at 10:20

GoogleCodeExporter commented 8 years ago
> Oh, and as the copypaste above shows, the error didn't give me path to the 
faulty
> picture :(

because you used an old version (not the svn version)

but I'd just build/upload linux version to 0.3.282 release !
(update and install or get the deb here : http://jbrout.manatlan.com/download)

but this release is 3x bigger than the previous 0.3.174 ?!
(i'm looking what is the problem)

Original comment by manat...@gmail.com on 9 Feb 2010 at 10:33

GoogleCodeExporter commented 8 years ago
Oh hey, thanks for the quick response!
I'll update the version asap, when my current scanning of about 25000 pics is 
over.

Original comment by yur...@gmail.com on 9 Feb 2010 at 10:44

GoogleCodeExporter commented 8 years ago
I confirm that current version (0.3.282) does show path in the error message, 
though
that wasn't the main issue. Anyway as far as I'm concerned, I managed to find 
and
remove all my corrupted images and now enjoying sorting all the rest. 
Thanks again for the program itself!

Original comment by yur...@gmail.com on 11 Feb 2010 at 12:27

GoogleCodeExporter commented 8 years ago
Same problem in a scanner situation.

I'm scanning picture directly in a directory seen by jBrout.
When the scanner starts to scan a picture, it creates an empty file with the 
name of the picture. If JBrout scans the directory when the file is empty, it 
raises an error and cancels the directory scan, forgetting all the correct 
pictures it has just found. That behaviour forces me to wait until the sanner 
job is done, but I could not wait further more !

To keep jBrout scanning the directory I have changed the "Raise error" by a 
"print", so the corrupted file name appears in the terminal if jBrout has been 
ran from terminal. 

This way, jBrout directory scan leaves corrupted files aside. I did not 
encounter bugs after that change... but I'm not sure it is safe.

Changes made in db.py line 194
--Before--
            # and raise exception
            raise Exception(err+"\nPhoto has incorrect exif/iptc tags, can't be imported :\n"+str([file,]))
            return None

--After--
            # and raise exception
            # raise Exception(err+"\nPhoto has incorrect exif/iptc tags, can't be imported :\n"+str([file,]))
            print ("Photo has incorrect exif/iptc tags, can't be imported :\n"+str([file,]))
            return None

Original comment by antonin....@gmail.com on 13 Sep 2010 at 9:16

GoogleCodeExporter commented 8 years ago
Hi.  

Background:

I am thinking of trying to make money by uploading photos to stock-photo 
websites.  It was recommended that keywords be embedded in the photos, and Gimp 
not only cannot do that, it erases any that do exist.  I therefore am trying 
JBrout to tag photos with IPTC keywords.
I intend JBrout only to have access to photos that I am planning to upload 
(since I see no reason to keyword thousands of photos that may never be used).

Problem:

I copied one photo into a folder that will be used for stock-photos, as a test, 
and
attempted to have JBrout open it.
I got the same sort of error that has been discussed here:
"Traceback (most recent call last):
   File "/usr/lib/jbrout/jbrout.py", line 2550, in on_btn_addFolder_clicked
    self.on_drop_folders_from_os(self.treeviewdb.get_model(),[folder])
   File "/usr/lib/jbrout/jbrout.py", line 1634, in on_drop_folders_from_os
    for nb in iterator:
   File "/usr/lib/jbrout/jbrout/db.py", line 132, in add
    self.__addPhoto( file ,tags,filesInBasket)
   File "/usr/lib/jbrout/jbrout/db.py", line 192, in __addPhoto
    raise Exception(err+"\nPhoto has incorrect exif/iptc tags, can't be imported :\n"+str([file,]))
 Exception: Traceback (most recent call last):
  File "/usr/lib/jbrout/jbrout/db.py", line 181, in __addPhoto
    needAutoRotation=DBPhotos.autorotAtImport,
  File "/usr/lib/jbrout/jbrout/tools.py", line 195, in __init__
    self.__info = pyexiv2.Image(self.__file)
AttributeError: 'module' object has no attribute 'Image'

Photo has incorrect exif/iptc tags, can't be imported :
[u'/data/scott/Photos/PhotosForStock/TGEC0189.JPG']"

[Originally, I had just a link to the photo there, as I see no reason to have 4 
or more full-size copies of each photo taking up space on my hard drive - 
especially if I manage to do as some photographers have done and have 1500 or 
more photos on one or more stock-photo sites...
However, when the link-file generated the error, I removed it and placed a 
full-size
file there, and had the same error.]

scott@scott-AsusM2N68-AM-Plus:~$ uname -a
Linux scott-AsusM2N68-AM-Plus 3.0.0-14-generic-tuxonice #23~ppa1-Ubuntu SMP Sun 
Dec 11 04:53:00 UTC 2011 i686 athlon i386 GNU/Linux
scott@scott-AsusM2N68-AM-Plus:~$ jbrout --version
JBrout 0.3.284
I am currently using Ubuntu 11.10, and usually using Gnome Shell instead of 
Unity
("...not that there's anything WRONG with that...")
I just picked a random photo, amongst those I think might be usable for stock, 
and 
neither Nautilus nor Eye of GNOME image viewer has any problem with it.  I have 
had two cameras, and have never had any problem with any picture generated with 
them (with the exception of when I tried to do a backup of photos and other 
documents with Brasero once and ended up with a DVD full of unusable files - 
with nothing from Brasero indicating that anything was wrong...)

I do not know what is wrong here, but if someone can find a solution for this, 
I would be very grateful.

-Scott

Original comment by scott092...@aol.com on 9 Jan 2012 at 10:26

Attachments:

GoogleCodeExporter commented 8 years ago
Your picture works fine in my jbrout (0.3.340)
but I should realease a deb from the svn version ;-)

Original comment by manat...@gmail.com on 19 Feb 2012 at 12:47

GoogleCodeExporter commented 8 years ago
Please fix this issue. I am dealing with an image library of about 14,000 
photos. I am getting the cannot import error mainly on some photos that have 
been scanned in(but not all). I realize that these were not taken by a camera, 
but they are jpgs, and are "photos" that are part of my library. It would be 
impractical to remove these, and more importantly, they belong in the photo 
library. It would make sense to just ignore and log the files that jBrout can't 
handle and move on.

(using jbrout 0.3.282 in Win 7)

Original comment by chri...@gmail.com on 25 Jul 2012 at 1:26

GoogleCodeExporter commented 8 years ago
I hate to say it, but it seems to me that jbrout is now finally completely dead 
and abandoned. I wouldn't expect new .debs anytime soon. However, the plain 
trunk version seems to work for me fine 
(http://mcepl.fedorapeople.org/tmp/TGEC0189.JPG has some included tags). So, I 
see these options:

 * checkout the latest code from svn (http://code.google.com/p/jbrout/source/checkout) and run directly from it:
   cd jbrout ; ./jbrout.py
 * if you have somewhere a Fedora around, then Fedora packages (maintained by me ;)) have the latest master with some more patches applied (all my commits are in http://luther.ceplovi.cz/git/?p=jbrout.git ... additional patches are in topic branches)
 * I hate to say, but shotwell (at least in version 0.12.3 I have here with Edit/Preferences/Write tags, titles, and other metadata to photo files switched on) works with tags pretty well too. It is not 100% replacement for jbrout yet for me (I like my real directories on the disc), but considering the state of jbrout, I am switching to it. GThumb (at least in version 3.0.1 I have here) works with tags included in pictures reasonably as well.

Original comment by matej.c...@gmail.com on 25 Jul 2012 at 8:48

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r342.

Original comment by r...@wallace.gen.nz on 4 Oct 2012 at 10:28