zdenop / qt-box-editor

QT4 editor of tesseract-ocr box files
https://zdenop.github.io/qt-box-editor/
Apache License 2.0
170 stars 66 forks source link

ver 1.12, ubuntu -> Error in findFileFormatStream: failed to read first 12 bytes of file #52

Closed jmokoistinen closed 8 years ago

jmokoistinen commented 8 years ago

When trying to open tif/box file pair from the editor Error in findFileFormatStream: failed to read first 12 bytes of file And the file does not open.

jmokoistinen commented 8 years ago

Also this occur sometimes Error in fopenReadStream: file not found Error in fileFormatIsTiff: stream not defined

zdenop commented 8 years ago

Please provide example files.

jmokoistinen commented 8 years ago

libtifiles-dev was missing apt-get install libtifiles-dev solved my problem

Not fully seems it I can only edit the box file once from one terminal session. So if I want to access again the same file I need to open qt-box-editor from new terminal.

patchworquill commented 1 year ago

For future people who get here:

I was using os.listdir() to enumerate the files within a directory, but one of the cases I hadn't considered was that a directory within the results of os.listdir() was matching the naming pattern I was filtering on.

Adding an additional condition as follows worked for me:

for item in os.listdir():
    if "name" in item and os.path.isfile(item):
         # do stuff

The important thing to add is a condition that checks it is a file, and ideally it should check that it is an image file, because the error here is that the file being processed is not an image file