Comments (8)
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.
By the way, I used to compile exiv2 with VS2015, but the latest exiv2 project can only be compiled with VS2017.
from pyexiv2.
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.
I changed a little code, rebuilt, and then successfully read XMP.
commit 715ce1d
Please confirm whether the problem has been solved.
from pyexiv2.
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.
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.
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.
This issue has been automatically closed because there has been no activity for a month.
from pyexiv2.
Related Issues (20)
- IPTC中文乱码 HOT 5
- issues on mac m1 HOT 1
- Unicode-related issue HOT 1
- Old version in pypi, not working with 3.11 HOT 7
- Hi i am search for adding XMP tags to IPTC is it possible by any means ? HOT 3
- tif 图获取ICC Profile解码出错 HOT 6
- How to set Exif.Image.ImageID properties HOT 1
- XMP Toolkit error 201: Error in XMLValidator HOT 6
- Speed fluctuations in windows 11 HOT 3
- latest version 2.8.2 doesn't work on Ubuntu 20.04 HOT 3
- Python 3.12 wheels missing and no source release on PyPI HOT 3
- How to catch "bad metadata" vs no metadata HOT 3
- Err 2 HOT 8
- Large exif data HOT 2
- modify_xmp() errors with 'Composite nodes can't have values' HOT 5
- Auto register additional XMP namespaces HOT 4
- Support conversion HOT 2
- Open image with german umlauts HOT 4
- exiv2api.cpp will compile with exiv2 until version 0.27.7 HOT 3
- Copying exif data containing duplicate keys HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyexiv2.