Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/316.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用MTurk的externalQuestion创建的命中在沙箱中不起作用_Python_Amazon_Boto3_Mechanicalturk - Fatal编程技术网

Python 使用MTurk的externalQuestion创建的命中在沙箱中不起作用

Python 使用MTurk的externalQuestion创建的命中在沙箱中不起作用,python,amazon,boto3,mechanicalturk,Python,Amazon,Boto3,Mechanicalturk,我是MTurk的新手,一直在尝试在这个平台上实现我的点评web应用程序。我已经根据kaflurbaleen.blogspot的教程使用ExternalQuestion成功创建了一个命中。但是,当我在沙箱中测试代码时,我意识到命中没有按预期工作。我发现如下两个问题 我找不到应该附加到URL的“assignmentId”。在接受任务之前,我检查了workersandbox并找到了以下URL 据我所知,“assignmentId”应该在接受上述链接后附加到URL。必须使用“externalSubmi

我是MTurk的新手,一直在尝试在这个平台上实现我的点评web应用程序。我已经根据kaflurbaleen.blogspot的教程使用ExternalQuestion成功创建了一个命中。但是,当我在沙箱中测试代码时,我意识到命中没有按预期工作。我发现如下两个问题

  • 我找不到应该附加到URL的“assignmentId”。在接受任务之前,我检查了workersandbox并找到了以下URL

    据我所知,“assignmentId”应该在接受上述链接后附加到URL。必须使用“externalSubmit”方法将此参数返回给Mturk服务器。验收后,我只发现以下参数 hitId&prevHitSubmitted&prevRequester&requesterId&prevReward&HitAutoAppDelayUnseconds&groupId&signature

  • 我还意识到该应用程序在iframe中没有按预期工作。每个(鼠标点击+移动)都应该创建一个红色球体,如原始网站所示

  • 我曾尝试用谷歌搜索答案,但收效甚微。我现在对这两个阻碍我研究的问题束手无策。任何帮助都将不胜感激。使用BOTO3创建HIT的代码如下所示

    import boto.mturk.connection
    
    # define the host environment
    sandbox_host = 'mechanicalturk.sandbox.amazonaws.com'
    real_host = 'mechanicalturk.amazonaws.com'
    
    mturk = boto.mturk.connection.MTurkConnection(
            host = sandbox_host,
            debug = 1
            )
    
    # test the setup of boto by printing the version and account balance
    print(boto.Version)
    print(mturk.get_account_balance())
    
    # link to my web app, which will be loaded by the iframe of Mturk
    URL = "https://s3.amazonaws.com/www.pickvertex3js.com/vertexpicking.html" 
    
    # setting task description of the iframe
    title = "A Special HIT for Picking!" 
    description = "Vertex picking!" 
    keywords = ["3D mesh", "vertices"] 
    frame_height = 500 # the height of the iframe holding the external hit 
    amount = .00
    
    # creating the HIT (task)
    questionform = boto.mturk.question.ExternalQuestion( URL, frame_height ) 
    response = mturk.create_hit( 
            title = title, 
            description = description, 
            keywords = keywords, 
            question = questionform, 
            reward = boto.mturk.price.Price( amount = amount),
            response_groups = ('Minimal', 'HITDetail'),
            ) 
    
    # trying to get some outputs
    HIT = response[0] 
    assert response.status 
    
    print ('[create_hit( %s, $%s ): %s]' % ( URL, amount, HIT.HITId ) )
    
    # The response included several fields that will be helpful later
    print ('Your HIT has been created. You can see it at this link:')
    print ('https://workersandbox.mturk.com/mturk/preview?groupId={}'.format(HIT.HITTypeId))
    print ('Your HIT ID is: {}'.format(HIT.HITId))
    

    我也在AWS开发者论坛上发布了回复,但也在这里添加了回复

    以下是帖子:

    这里有一份副本供其他人使用,以便从中受益:

    我看了你的热门歌曲,想在这里提供一些建议。首先,一些基本的东西,以防它们有所帮助:

    1) 正在将assignmentId正确添加到您的点击中。您可以通过加载共享的页面(),单击View Source并滚动到标记来确认这一点。您应该看到如下内容:

    <iframe height="500" scrolling="auto" frameborder="0" align="center" src="https://s3.amazonaws.com/www.pickvertex3js.com/vertexpicking.html?assignmentId=ASSIGNMENT_ID_NOT_AVAILABLE&amp;hitId=33K3E8REWX0SAJQPACFE1K5LTDBX8G" name="ExternalQuestionIFrame"></iframe>
    
    <iframe height="500" scrolling="auto" frameborder="0" align="center" src="https://s3.amazonaws.com/www.pickvertex3js.com/vertexpicking.html?assignmentId=38YMOXR4MW4S3P05XVRV37Q4QFGW6D&amp;hitId=33K3E8REWX0SAJQPACFE1K5LTDBX8G&amp;workerId=A39ECJ12CY7TE9&amp;turkSubmitTo=https%3A%2F%2Fworkersandbox.mturk.com" name="ExternalQuestionIFrame"></iframe>
    
    var mouse3D = new THREE.Vector3( ( event.clientX / window.innerWidth ) * 2 - 1, 
    -( event.clientY / window.innerHeight ) * 2 + 1, 
    0.5 ); 
    
    没有使用正确的窗口(即,没有使用IFRAME视口,而是使用整个浏览器窗口,导致奇怪/错误/错误的行为)

    简短的版本是,我不认为您的问题与MTurk本身有关,而是与IFRAME有关。作为一个不理想的解决方案,您还可以考虑将工作人员直接链接到您的页面(而不是iFrAME),并将其链接到MTURK上的提交URL。这并不理想,但我认为它可以工作

    希望有帮助