0

I'm using the retrieve_and_rank class in Python from the watson_developer_cloud package.

Main question:

In the create_config function, what type of object do we pass in for the config argument? A zip folder?

I'm using IBM's provided example configuration folder just to test, and when I call

retriever_and_ranker.create_config(MY_ID, CONFIG_NAME, 'blank_example_solr_config.zip')

I get this error:

WatsonException: unknown error

The zipped folder is in the same directory as my code. What should that last argument be? I'm wondering why it doesn't recognize the zip file from the string I'm passing in.

ralphearle
  • 1,696
  • 13
  • 18
pythonian
  • 1
  • 1
  • 3

1 Answers1

0

I realized the key was that I was incorrectly passing in a string, as opposed to an open file object.

You need to use the

with open("file.zip", "rb) as fp:
    ...

as in joe's answer.

pythonian
  • 1
  • 1
  • 3