Code Monkey home page Code Monkey logo

Comments (8)

LeoHsiao1 avatar LeoHsiao1 commented on July 23, 2024 1

Thanks for your report.
When I'm using your images auphofBSF@3890a83, I can call .read_exif() and .read_iptc() normally, but calling .read_xmp() always causes Python to crash.
The good news is that this problem can be repeated. I'll start debugging it now.

from pyexiv2.

LeoHsiao1 avatar LeoHsiao1 commented on July 23, 2024 1

By the way, I used to compile exiv2 with VS2015, but the latest exiv2 project can only be compiled with VS2017.

from pyexiv2.

auphofBSF avatar auphofBSF commented on July 23, 2024 1

Sounds like a tricky bug, your commit makes it at least work sometimes for more than 1 read but unfortunately it still fails for me with Python Crash after an seemingly unpredictable number of reads. sorry I cant contribute more to the cpp debugging

In my test I have a folder of 43 Nikon images processed by Digikam.
The following code Fails at random number of iterations, 7,16,19,12,6,10,3 (no pattern evident). It has never processed all 43.

from os import listdir
from os.path import isfile, join
files = [f for f in listdir(mypath) if isfile(os.path.join(mypath, f))]

for i,f in enumerate(files):
    image = Image(os.path.join(mypath, f))
    try:
        xmpDict = image.read_xmp()
        print('{} | Image: {}  Xmp.digiKam.TagsList: {}  Xmp.dc.subject: {}   -----------------'.format(i, image.filename,
                xmpDict['Xmp.digiKam.TagsList'],
                xmpDict['Xmp.dc.subject']))

    #     xmpDictNew = xmpDict.copy()
    #     xmpDictNew['Xmp.dc.subject'] = xmpDict['Xmp.digiKam.TagsList']
    #     xmpDictNew['Xmp.dc.subject'] = "TEST"
    #     # image.modify_xmp(xmpDictNew)
    except Exception as e:
        print("Error:{}".format(e))

from pyexiv2.

LeoHsiao1 avatar LeoHsiao1 commented on July 23, 2024

I changed a little code, rebuilt, and then successfully read XMP.
commit 715ce1d
Please confirm whether the problem has been solved.

from pyexiv2.

LeoHsiao1 avatar LeoHsiao1 commented on July 23, 2024

Yesterday, I tried to do this on Linux, and it reads normally. But doing this on Windows would cause Python to crash.

When calling the read_*() method, Python will call the C++ API, and the C++ API wil read the metadata and return it to Python.
Since there are many data need to be returned, I use an EOL symbol to separate them.

What confuses me is that:

  • When EOL is set to "\n\r", reading metadata will randomly causes the program to crash. Sometimes it crashes during the reading, sometimes after a reading, and sometimes during a repeated reading.
  • When EOL is set to "\n \r" (just add a space), I can read 1000 times in 10 seconds with no problem.

from pyexiv2.

LeoHsiao1 avatar LeoHsiao1 commented on July 23, 2024

Random crashes are usually caused by memory exceptions.
This problem seems to be caused by the use of local variables outside of scope, like this:

std::stringstream data;
data << "some data...";
make_buffer(data.str());
// the data which data.str() returns, may have been destroyed when the function make_buffer() reads it

I have corrected the use of stringstream.str(), and now none of the previous problems would be repeated on my computer.
commit 028f6418

Please confirm whether the problem has been solved.

from pyexiv2.

auphofBSF avatar auphofBSF commented on July 23, 2024

Fantastic, @LeoHsiao1, I've learnt a lot and this now works well for the test case of 42 images. Well done. I am happy to mark this issue closed

from pyexiv2.

github-actions avatar github-actions commented on July 23, 2024

This issue has been automatically closed because there has been no activity for a month.

from pyexiv2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.