edissyum / opencapture

Open-Capture is the one and only 100% Open Source intelligent document capture solution
https://kutt.it/OpenCaptureWebSite
GNU General Public License v3.0
24 stars 11 forks source link

again the 500 errer internal servor #1312

Closed rayansdsd closed 6 months ago

rayansdsd commented 6 months ago

i installed open capture on another device and i tried to configuret the code of duplicated mask as you asked me on the new device def duplicate_positions_mask(position_mask_id): positions_masks_info, error = positions_masks.get_positions_mask_by_id({'position_mask_id': position_mask_id}) if error is None: new_label = gettext('COPY_OF') + ' ' + positions_masks_info['label'] args = { 'label': new_label, 'supplier_id': positions_masks_info['supplier_id'], 'pages': json.dumps(positions_masks_info['pages']), 'regex': json.dumps(positions_masks_info['regex']), 'width': positions_masks_info['width'], 'form_id': positions_masks_info['form_id'], 'nb_pages': positions_masks_info['nb_pages'], 'filename': positions_masks_info['filename'], 'supplier_id': positions_masks_info['supplier_id'], 'pages': json.dumps(positions_masks_info['pages']), 'regex': json.dumps(positions_masks_info['regex']), 'positions': json.dumps(positions_masks_info['positions'])

    }
    _, error = positions_masks.add_positions_mask(args)
    if error is None:
        return '', 200
    else:
        response = {
            "errors": gettext('DUPLICATE_POSITIONS_MASKS_ERROR'),
            "message": gettext(error)
        }
        return response, 400
else:
    response = {
        "errors": gettext('DUPLICATE_POSITIONS_MASKS_ERROR'),
        "message": gettext(error)
    }
    return response, 400

but it's not workng thelog: (opencapture) jeanmarc@debian:~$ sudo tail -f /var/log/apache2/error.log [sudo] Mot de passe de jeanmarc : [Tue Feb 27 15:40:54.581975 2024] [wsgi:error] [pid 1330] [remote 127.0.0.1:48528] File "/var/www/html/opencapture/src/backend/rest/positions_masks.py", line 145, in duplicate_positions_mask [Tue Feb 27 15:40:54.581982 2024] [wsgi:error] [pid 1330] [remote 127.0.0.1:48528] res = positions_masks.duplicate_positions_mask(position_mask_id) [Tue Feb 27 15:40:54.581988 2024] [wsgi:error] [pid 1330] [remote 127.0.0.1:48528] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [Tue Feb 27 15:40:54.582009 2024] [wsgi:error] [pid 1330] [remote 127.0.0.1:48528] File "/var/www/html/opencapture/src/backend/controllers/positions_masks.py", line 178, in duplicate_positions_mask [Tue Feb 27 15:40:54.582016 2024] [wsgi:error] [pid 1330] [remote 127.0.0.1:48528] 'pages': json.dumps(positions_masks_info['pages']), [Tue Feb 27 15:40:54.582023 2024] [wsgi:error] [pid 1330] [remote 127.0.0.1:48528] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [Tue Feb 27 15:40:54.582030 2024] [wsgi:error] [pid 1330] [remote 127.0.0.1:48528] File "/var/www/html/opencapture/src/backend/models/positions_masks.py", line 131, in add_positions_mask [Tue Feb 27 15:40:54.582066 2024] [wsgi:error] [pid 1330] [remote 127.0.0.1:48528] 'form_id': args['form_id'], [Tue Feb 27 15:40:54.582073 2024] [wsgi:error] [pid 1330] [remote 127.0.0.1:48528] ~~~~^^^^^^^^^^^ [Tue Feb 27 15:40:54.582080 2024] [wsgi:error] [pid 1330] [remote 127.0.0.1:48528] KeyError: 'form_id'

for the version opencapture whi i am using it s opencapture 3.1.2

nathan30 commented 6 months ago

You have to restart apache