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

Exception when running harvesters with HARVESTERS_LOG_BUFFER_MANIPULATION enabled #282

Closed
1 task done
StefanD986 opened this issue Feb 24, 2022 · 1 comment · Fixed by #284
Closed
1 task done
Labels
bug Something isn't working
Milestone

Comments

@StefanD986
Copy link

Describe the Bug
When running Harvesters with the environment variable HARVESTERS_LOG_BUFFER_MANIPULATION set to True, Harvesters will throw an exception.

To Reproduce
Steps to reproduce the behavior:

  1. Set environment variable HARVESTERS_LOG_BUFFER_MANIPULATION to True
  2. Copy the minimal example script attached at the end of this issue and adapt the path to the cti file!
  3. Run the minimal example script
  4. Observe log output

Expected Behavior
No errors

Actual Behavior
The following error message can be seen:

Traceback (most recent call last):
  File "C:/Users/Stefan/AppData/Roaming/JetBrains/PyCharm2021.3/scratches/scratch_22.py", line 31, in <module>
    main()
  File "C:/Users/Stefan/AppData/Roaming/JetBrains/PyCharm2021.3/scratches/scratch_22.py", line 23, in main
    pass
  File "c:\users\stefan\pycharmprojects\harvesters\src\harvesters\core.py", line 1160, in __exit__
    self.queue()
  File "c:\users\stefan\pycharmprojects\harvesters\src\harvesters\core.py", line 1257, in queue
    _family_tree(self._buffer.module.parent)
  File "C:\Users\Stefan\.venvs\fipy38\lib\site-packages\genicam\gentl.py", line 4260, in <lambda>
    __getattr__ = lambda self, name: _swig_getattr(self, Buffer, name)
  File "C:\Users\Stefan\.venvs\fipy38\lib\site-packages\genicam\gentl.py", line 93, in _swig_getattr
    raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
AttributeError: 'Buffer' object has no attribute 'module'

Configuration

  • OS: Windows
  • Python: 3.8
  • Harvester: from git (see below)
  • GenTL Producer: Matrix Vision
  • Camera: Xenics Bobcat

Reproducibility
I bisected through the harvesters commits, and the first commit that shows this issue is 3d579a7dc917f7bb25333997cd9ac5b8cd29d5f0

This phenomenon can be reproduced by other versions:

  • [x ] Yes, all commits between at least 3d579a7dc917f7bb25333997cd9ac5b8cd29d5f0 and master (as of to date) are affected

Actions You Have Taken

Additional context

import logging

from harvesters.core import Harvester, ImageAcquirer

FORMAT = '%(name)s - %(asctime)s: %(message)s'
logging.basicConfig(level=logging.DEBUG, format=FORMAT)
logger = logging.getLogger('test_application')

def main():
    h = Harvester(logger=logging.getLogger("harvesters"))

    h.add_file(
        "!!!!CHANGE_ME!!!!/mvGenTLProducer.cti"
    )
    h.update()

    logger.info(f"{h.device_info_list=}")

    ia = h.create_image_acquirer(0)
    ia.start_acquisition()

    with ia.fetch_buffer() as buffer:
        pass

    ia.stop_acquisition()  # Harvesters will lock up here.

    ia.destroy()
    h.reset()

if __name__ == '__main__':
    main()
@kazunarikudo
Copy link
Member

@StefanD986 Hi, thank you for the report. I will fix that. Regards, Kazunari.

@kazunarikudo kazunarikudo added the bug Something isn't working label Feb 25, 2022
@kazunarikudo kazunarikudo added this to the 1.3.3 milestone Feb 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants