An error occurred while trying to load component

32 views
Skip to first unread message

Team SPQR

unread,
Jan 18, 2022, 4:43:44 PM1/18/22
to ope...@googlegroups.com
Hello OpenMPF Team,

I'm attempting to write a super simple component following the guide at https://openmpf.github.io/docs/site/Python-Batch-Component-API/index.html but after building the component when I try to run I get the below error:

user@42 DeepFaceComponent % docker run --network openmpf_default -v openmpf_shared_data:/opt/mpf/share -e WFM_USER=admin -e WFM_PASSWORD=mpfadm deepface_component
No command line arguments. Starting as regular component...
Loading descriptor from /opt/mpf/plugins/DeepFaceComponent/descriptor/descriptor.json
Registration response: b'{"message":"New component registered."}'
Starting component executor with command: /opt/mpf/bin/amq_detection_component 'failover://(tcp://activemq:61616)?jms.prefetchPolicy.all=0&startupMaxReconnectAttempts=1' /opt/mpf/plugins/DeepFaceComponent/deepface_component.py MPF.DETECTION_DEEPFACE_REQUEST python
An error occurred while trying to load component: The module located at "/opt/mpf/plugins/DeepFaceComponent/deepface_component.py" did not contain a module level variable named "EXPORT_MPF_COMPONENT". Python components must declare a module level variable named "EXPORT_MPF_COMPONENT", which gets assigned to either a class or some other callable.
Executor exit code = 38

However, the component code does have the EXPORT_MPF_COMPONENT:

import logging

import mpf_component_api as mpf
import mpf_component_util as mpf_util

logger = logging.getLogger('DeepFaceComponent')

class DeepFaceComponent(object):
    detection_type = 'FACE'

    @staticmethod
    def get_detections_from_image(self, image_job: mpf.ImageJob):
        print(image_job)

        # Must return mpf_component_api.ImageLocation
        return mpf.ImageLocation(0, 0, 100, 100, 1.0, {'CLASSIFICATION': 'backpack'})

EXPORT_MPF_COMPONENT = DeepFaceComponent

Any suggestions? 

Thanks. 

brose...@mitre.org

unread,
Jan 18, 2022, 5:10:41 PM1/18/22
to OpenMPF
Could you attach a zip or .tar.gz of your project, if not at least the descriptor.json? 
Reply all
Reply to author
Forward
0 new messages