Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attribute Error - 'ExifTool' object has no attribute 'getMetadata' #177

Open
anthea-ops opened this issue Mar 4, 2022 · 8 comments
Open

Comments

@anthea-ops
Copy link

Hello, new to python and having difficulty; this may be basic and I am just missing something. Please indicate if you need more information. This is the error message I am getting when running the second part of the startup (MicaSense Image Processing Setup) code:

Successfully imported all required libraries.

Successfully executed exiftool.

AttributeError Traceback (most recent call last)
/var/folders/dq/xpxx0g3j4r5gxc2n777_j9l40000gp/T/ipykernel_8445/1712436492.py in
34 imageName = glob.glob(os.path.join(imagePath,'IMG_0000_1.tif'))[0]
35
---> 36 img = Image(imageName)
37 img.plot_raw(figsize=(8.73,8.73));
38

~/VIMS/imageprocessing/micasense/image.py in init(self, image_path, exiftool_obj)
67 raise IOError("Provided path is not a file: {}".format(image_path))
68 self.path = image_path
---> 69 self.meta = metadata.Metadata(self.path, exiftool_obj=exiftool_obj)
70
71 if self.meta.band_name() is None:

~/VIMS/imageprocessing/micasense/metadata.py in init(self, filename, exiftoolPath, exiftool_obj)
47 raise IOError("Input path is not a file")
48 with exiftool.ExifTool(self.exiftoolPath) as exift:
---> 49 self.exif = exift.get_metadata(filename)
50
51 def get_all(self):

AttributeError: 'ExifTool' object has no attribute 'get_metadata'

Thank you.

@volpatoo
Copy link

volpatoo commented Mar 4, 2022

Hello,

I have got the same issue. Well, I am glad to know that more users had the same problem because I was blamed for not being able to run a simple code...

Looking forward to seeing how to fix this problem. Thanks!

@mcbridejc
Copy link

Hi folks,

I happened to observe your issue, and can tell you that the problem you are seeing is due to changes in the API made in recent releases of pyexiftool by the new maintainer (https://github.com/sylikc/pyexiftool/).

To fix this issue -- at least in the interim until MicaSense can address it -- I suggest you try reverting to an older version. I think 0.4.13 is the version you want to go back to. To revert, using pip, run pip install pyexiftool==0.4.13. If you're using conda, I think conda install pyexiftool==0.4.13 is what you need (although I don't use conda so ymmv).

@volpatoo
Copy link

volpatoo commented Mar 5, 2022

Hello guys!

Thanks, God, for existing such good people in this world! I really appreciate that @mcbridejc. It worked well and now also passed in the test using pytest -n auto.

@anthea-ops
Copy link
Author

Thank you so much @mcbridejc

@fdarvas
Copy link
Contributor

fdarvas commented Mar 30, 2022

I looked into the the current repository for pyexiftool (https://github.com/sylikc/pyexiftool/) and it looks like the code does not support the 'get_metadata(filename)' method for the Exiftool object anymore - not sure if that is intentional or if that is simply work in progress.
At the moment sticking with an older version of pyexiftool, e.g. pyexiftool==0.4.13 seems to be the best course of action - I will update setup.py to to require pyexiftool<=0.4.13 for now.

On closer inspection , it turns out that the call to :

with exiftool.ExifTool(self.exiftoolPath) as exift:
      self.exif = exift.get_metadata(filename)

needs to be replaced with

with exiftool.ExifTooHelperl(self.exiftoolPath) as exift:
      self.exif = exift.get_metadata(filename)

if used with the current version of the toolbox.

@wwolff7
Copy link

wwolff7 commented Apr 22, 2022

@mcbridejc works for me too. Thanks a lot!

@FlLobo
Copy link

FlLobo commented Mar 13, 2024

Hello, I am having a similar issue even after downgrading to pyexiftool==0.4.13.

I got he following error when trying to run the Setup.ipynb :

`---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[2], line 5
2 imagePath = os.path.join('.','data','REDEDGE-MX')
3 imageName = glob.glob(os.path.join(imagePath,'IMG_0001_1.tif'))[0]
----> 5 img = Image(imageName)
6 img.plot_raw(figsize=(8.73,8.73));
8 from micasense.panel import Panel

File ~\imageprocessing\micasense\image.py:72, in Image.init(self, image_path, exiftool_obj, allow_uncalibrated)
70 raise IOError("Provided path is not a file: {}".format(image_path))
71 self.path = image_path
---> 72 self.meta = metadata.Metadata(self.path, exiftool_obj=exiftool_obj)
74 if self.meta.band_name() is None:
75 raise ValueError("Provided file path does not have a band name: {}".format(image_path))

File ~\imageprocessing\micasense\metadata.py:51, in Metadata.init(self, filename, exiftool_path, exiftool_obj)
49 if not os.path.isfile(filename):
50 raise IOError("Input path is not a file")
---> 51 with exiftool.ExifToolHelper() as exift:
52 self.exif = exift.get_metadata(filename)

AttributeError: module 'exiftool' has no attribute 'ExifToolHelper'
`
Is there a solution for this? Any help, please (a few days trying to figure out)

@Mithoon278
Copy link

Hello, I am having a similar issue even after downgrading to pyexiftool==0.4.13.

I got he following error when trying to run the Setup.ipynb :

`--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[2], line 5 2 imagePath = os.path.join('.','data','REDEDGE-MX') 3 imageName = glob.glob(os.path.join(imagePath,'IMG_0001_1.tif'))[0] ----> 5 img = Image(imageName) 6 img.plot_raw(figsize=(8.73,8.73)); 8 from micasense.panel import Panel

File ~\imageprocessing\micasense\image.py:72, in Image.init(self, image_path, exiftool_obj, allow_uncalibrated) 70 raise IOError("Provided path is not a file: {}".format(image_path)) 71 self.path = image_path ---> 72 self.meta = metadata.Metadata(self.path, exiftool_obj=exiftool_obj) 74 if self.meta.band_name() is None: 75 raise ValueError("Provided file path does not have a band name: {}".format(image_path))

File ~\imageprocessing\micasense\metadata.py:51, in Metadata.init(self, filename, exiftool_path, exiftool_obj) 49 if not os.path.isfile(filename): 50 raise IOError("Input path is not a file") ---> 51 with exiftool.ExifToolHelper() as exift: 52 self.exif = exift.get_metadata(filename)

AttributeError: module 'exiftool' has no attribute 'ExifToolHelper' ` Is there a solution for this? Any help, please (a few days trying to figure out)

i am also getting the same error.can anyone help me out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants