我尝试使用 Python 在 mturk 上发布示例问题,因此我按照教程并复制其代码,如下所示。但是,我总是收到如下错误:
File "C:/Users/jingh/PycharmProjects/test/example.py", line 22, in
<module>
question = open(name='questions.xml',mode='r').read()
TypeError: open() missing required argument 'file' (pos 1)
Process finished with exit code 1
question = open(name='questions.xml',mode='r').read()
new_hit = client.create_hit(
Title = 'Is this Tweet happy, angry, excited, scared, annoyed or upset?',
Description = 'Read this tweet and type out one word to describe the emotion of the person posting it: happy, angry, scared, annoyed or upset',
Keywords = 'text, quick, labeling',
Reward = '0.15',
MaxAssignments = 1,
LifetimeInSeconds = 172800,
AssignmentDurationInSeconds = 600,
AutoApprovalDelayInSeconds = 14400,
Question = question,
)
print ("A new HIT has been created. You can preview it here:")
print ("https://workersandbox.mturk.com/mturk/preview?groupId=" + new_hit['HIT']['HITGroupId'])
print ("HITID = " + new_hit['HIT']['HITId'] + " (Use to Get Results)")