Используя Python 3.7 и boto3 для создания HIT на MTurk, библиотека boto3 падает со следующей ошибкой. Я провел некоторое тестирование и пришел к выводу, что ошибка вызвана символом «??» в поле HITLayoutParameters
(см. Ниже).
Как можно избежать этой проблемы при загрузке текста в исходном виде?
hit_layout_id = 'XXXXM4PUG5TWD3TK4NDUWHRJUUXXXX'
hit_layout_params = [{'Name': 'text', 'Value': 'Listening and learning, but standing strong ?? pic.twitter.com/7TSroSf8h1 — Ilhan Omar (@IlhanMN) February 11, 2019\n<u><b>Omar</b></u> did not apologize, however, for another anti-Semitic comment she made in February, accusing pro-Israel Americans of having an “allegiance to a foreign country.”'}, {'Name': 'target', 'Value': 'Omar'}]
hit_type_id = 'XXXX7R2NRGZ96BC693FAIJ5481XXXX'
lifetime_in_seconds = 259200
num_max_assignments = 5
# boto3 client initialization
client = ...
# upload the hit
client.create_hit_with_hit_type(
HITTypeId=hit_type_id,
MaxAssignments=num_max_assignments,
LifetimeInSeconds=lifetime_in_seconds,
RequesterAnnotation=requester_annotation,
HITLayoutId=hit_layout_id,
HITLayoutParameters=hit_layout_params,
)