cloudyr / pyMTurkR

A Client for the MTurk Requester API
15 stars 8 forks source link

CreateQualificationType() error from test.duration #1

Closed erossiter closed 5 years ago

erossiter commented 5 years ago

Hi, I ran into an error using the CreateQualificationType function. I'm guessing somewhere in the function test.duration is converted to a string unintentionally, but I couldn't tell for sure by looking at it. I've included a minimal reproducible example. (Thank you by the way for creating pyMTurkR in the wake of the deprecation of the old API!)

#files in pyMTurkR_issue.zip
QuestionForm <- paste0(readLines('Test.xml'), collapse='')
AnswerKey <- paste0(readLines('AnswerKey.xml'), collapse='')

#works
qual1 <- CreateQualificationType(name = "qual 1",
                                description = "Enter code and accept HIT for discussion",
                                status = "Active")

#same error when trying to add test.duration
qual2 <- CreateQualificationType(name = "qual 2",
                                description = "Enter code and accept HIT for discussion",
                                status = "Active",
                                test.duration = seconds(minutes = 5),
                                test = QuestionForm, answerkey = AnswerKey)

qual3 <- CreateQualificationType(name = "qual 3",
                                description = "Enter code and accept HIT for discussion",
                                status = "Active",
                                test.duration = 300,
                                test = QuestionForm, answerkey = AnswerKey)

qual4 <- CreateQualificationType(name = "qual 4",
                                description = "Enter code and accept HIT for discussion",
                                status = "Active",
                                test.duration = "300",
                                test = QuestionForm, answerkey = AnswerKey)

Error in py_call_impl(callable, dots$args, dots$keywords) : ParamValidationError: Parameter validation failed: Invalid type for parameter TestDurationInSeconds, value: 300, type: <type 'str'>, valid types: <type 'int'>, <type 'long'> Error in CreateQualificationType(name = "qual 2", description = "Enter code and accept HIT for discussion", : Unable to create qualification

pyMTurkR_issue.zip

mattwoolz commented 5 years ago

@erossiter I am running into the same issue, let me know if you have been able to find a solution

tylerburleigh commented 5 years ago

@erossiter @mattwoolz

The latest commit https://github.com/cloudyr/pyMTurkR/commit/07ff4b6347ba26f1eb6ed12c4300affa1e572b6c should fix the issue.

It was indeed an issue with conversion to string type.

Thanks for testing the package!