Fitbit / thriftcli

Command line client for Thrift services
Other
31 stars 13 forks source link

Error: ValueError: need more than 0 values to unpack #14

Open kevinguard opened 6 years ago

kevinguard commented 6 years ago

Having the following as thrift file:

namespace java com.github.test

struct HealthRequest {
    1: required string userId
}

struct HealthResponse {
    1: required string status
}

service Test {
    HealthResponse health (
        1: HealthRequest healthRequest
    )
}

I am composing the client command as follows:

thriftcli localhost:4000 Test.heath idl/github.com/test/test.thrift --body '{"healthRequest": {"userId": "1"}}' -v -c -j

However, I keep getting this error:

Traceback (most recent call last):
  File "/usr/local/bin/thriftcli", line 11, in <module>
    load_entry_point('thriftcli==1.1', 'console_scripts', 'thriftcli')()
  File "build/bdist.macosx-10.13-x86_64/egg/thriftcli/thrift_cli.py", line 281, in main
  File "build/bdist.macosx-10.13-x86_64/egg/thriftcli/thrift_cli.py", line 251, in _run_cli
  File "build/bdist.macosx-10.13-x86_64/egg/thriftcli/thrift_cli.py", line 51, in __init__
  File "build/bdist.macosx-10.13-x86_64/egg/thriftcli/thrift_argument_converter.py", line 25, in __init__
  File "build/bdist.macosx-10.13-x86_64/egg/thriftcli/thrift_parser.py", line 164, in parse
  File "build/bdist.macosx-10.13-x86_64/egg/thriftcli/thrift_parser.py", line 288, in _parse_services
  File "build/bdist.macosx-10.13-x86_64/egg/thriftcli/thrift_parser.py", line 319, in _build_service_endpoints
  File "build/bdist.macosx-10.13-x86_64/egg/thriftcli/thrift_parser.py", line 333, in _parse_endpoints_from_service_definition
ValueError: need more than 0 values to unpack

Reviewing the documentations, I couldn't immediately identify the issue. Can someone help me understand where I am making mistake when issuing the aforementioned command? Thanks!

TobiasBales commented 6 years ago

I just stumbled across the same issue.

The problem is that each procedure needs to be on one line for the regex used to extract the information to work, e.g. HealthResponse health (1: HealthRequest healthRequest)

If I get it to work otherwise I will have a look and see if I can submit a PR that fixes that behaviour