【发布时间】:2018-11-30 15:05:01
【问题描述】:
我尝试使用 python 在 mturk 上发布一个示例问题,所以我按照教程复制他们的代码,如下所示。但是,我总是收到如下错误:
我想不通...请帮助! 谢谢!
文件“C:/Users/jingh/PycharmProjects/test/example.py”,第 22 行,在 问题 = open(name='questions.xml',mode='r').read() TypeError: open() 缺少必需的参数“文件”(位置 1)
进程以退出代码 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)")
# Remember to modify the URL above when you're publishing
# HITs to the live marketplace.
# Use: https://worker.mturk.com/mturk/preview?groupId=
【问题讨论】:
-
我建议您先阅读documentation 的打开方法。第一个参数不是
name,而是file。
标签: python