Specify CLI path for mTurk for Mac

百般思念 提交于 2019-12-08 06:56:48

问题


I am setting up the CLI on a MAC (iOS 10.9) and I believe I've set up the MTURK_CMD_HOME and JAVA_CMD_HOME paths correctly.

But, I'm still getting an error that the file can't be found when I run getBalance.sh. My code is as follows:

/users/USER/Desktop/aws-mturk-clt-1.3.1/
    -bash: /users/USER/Desktop/aws-mturk-clt-1.3.1/: is a directory
/System/Library/Frameworks/JavaVM.framework/Home
    -bash: /System/Library/Frameworks/JavaVM.framework/Home: is a directory
export MTURK_CMD_HOME=/users/USER/Desktop/aws-mturk-clt-1.3.1/
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
export PATH=$PATH:/users/USER/Desktop/aws-mturk-clt-1.3.1/bin
/users/USER/Desktop/aws-mturk-clt-1.3.1/bin/getBalance.sh

Returns the following error:

log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: ../log/aws-mturk-clt.log (No such file or directory)
    at java.io.FileOutputStream.openAppend(Native Method)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:192)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:116)
    at org.apache.log4j.FileAppender.setFile(FileAppender.java:290)
    at org.apache.log4j.RollingFileAppender.setFile(RollingFileAppender.java:194)
    at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:164)
    at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:257)
    at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:133)
    at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:97)
    at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:689)
    at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:647)
    at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:544)
    at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:440)
    at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:476)
    at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:471)
    at org.apache.log4j.LogManager.<clinit>(LogManager.java:125)
    at org.apache.log4j.Logger.getLogger(Logger.java:118)
    at com.amazonaws.mturk.cmd.AbstractCmd.<clinit>(AbstractCmd.java:51)
There was a problem reading your properties file from mturk.properties
The exception was java.io.FileNotFoundException: mturk.properties (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Cannot load configuration properties file from mturk.properties
    at com.amazonaws.mturk.util.PropertiesClientConfig.<init>(PropertiesClientConfig.java:99)
    at com.amazonaws.mturk.util.PropertiesClientConfig.<init>(PropertiesClientConfig.java:72)
    at com.amazonaws.mturk.cmd.AbstractCmd.<init>(AbstractCmd.java:61)
    at com.amazonaws.mturk.cmd.GetBalance.<init>(GetBalance.java:24)
    at com.amazonaws.mturk.cmd.GetBalance.main(GetBalance.java:27)
Caused by: java.io.FileNotFoundException: mturk.properties (No such file or directory)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:120)
    at com.amazonaws.mturk.util.PropertiesClientConfig.<init>        (PropertiesClientConfig.java:95)
    ... 4 more

It seems the directory is specified correctly (and bin contains getBalance.sh). I've double checked that my access keys are correct and the file path is correct. What do I do?


回答1:


This works for me (without needing to change any scripts). I did set the default access key and secret in the mturk.properties file and change the URL to the sandbox https address.

$ cd /Users/me/Downloads/aws-mturk-clt-1.3.1/bin
$ ./getBalance.sh 
An error occurred while fetching your balance: Error #1 for RequestId: 75edd876-61eb-4525-8c5a-5c984e1e31f3 - AWS.NotAuthorized: The identity contained in the request is not authorized to use this AWSAccessKeyId (1424124881922 s)
com.amazonaws.mturk.service.exception.AccessKeyException: Error #1 for RequestId: 75edd876-61eb-4525-8c5a-5c984e1e31f3 - AWS.NotAuthorized: The identity contained in the request is not authorized to use this AWSAccessKeyId (1424124881922 s)
    at com.amazonaws.mturk.filter.ErrorProcessingFilter.processErrors(ErrorProcessingFilter.java:91)
    at com.amazonaws.mturk.filter.ErrorProcessingFilter.execute(ErrorProcessingFilter.java:48)
    at com.amazonaws.mturk.filter.Filter.passMessage(Filter.java:56)
    at com.amazonaws.mturk.filter.RetryFilter.execute(RetryFilter.java:115)
    at com.amazonaws.mturk.filter.Filter.passMessage(Filter.java:56)
    at com.amazonaws.mturk.util.CLTExceptionFilter.sendMessage(CLTExceptionFilter.java:77)
    at com.amazonaws.mturk.util.CLTExceptionFilter.execute(CLTExceptionFilter.java:62)
    at com.amazonaws.mturk.service.axis.FilteredAWSService.executeRequests(FilteredAWSService.java:172)
    at com.amazonaws.mturk.service.axis.FilteredAWSService.executeRequest(FilteredAWSService.java:152)
    at com.amazonaws.mturk.service.axis.FilteredAWSService.executeRequest(FilteredAWSService.java:116)
    at com.amazonaws.mturk.service.axis.RequesterServiceRaw.getAccountBalance(RequesterServiceRaw.java:1193)
    at com.amazonaws.mturk.service.axis.RequesterService.getAccountBalance(RequesterService.java:922)
    at com.amazonaws.mturk.cmd.GetBalance.getBalance(GetBalance.java:50)
    at com.amazonaws.mturk.cmd.GetBalance.runCommand(GetBalance.java:41)
    at com.amazonaws.mturk.cmd.AbstractCmd.run(AbstractCmd.java:148)
    at com.amazonaws.mturk.cmd.GetBalance.main(GetBalance.java:28)

Have you tried running it from the bin dir? Actually cd into the directory rather than using the fully qualified path



来源:https://stackoverflow.com/questions/28534369/specify-cli-path-for-mturk-for-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!