-
Notifications
You must be signed in to change notification settings - Fork 28
Asyncio example does not run #12
Comments
After fixing the input args problem mentioned above, by changing the args to strings (b'foo' -> 'foo' and b'bar' -> 'bar'), I encountered another two problems running the example script. The first problem was that after calling the get function the returned value was actually a bytes object, whereas it was a string when the put function was called. I'm not sure what to recommend here - the behaviour is confusing. I have since run the synchronous example script from the docs (under the heading "Standard") and it too produces a bytes object - whereas the docs indicate that it returns a string. The second problem was in the delete step which deletes key Change response = yield from c.kv.delete(b'foo2') to response = yield from c.kv.delete('foo') Looks like some bit-rot in the docs examples. |
|
|
Which part is in need of a pull request? I was able to compile the asyncio example without editing the library. Is it just the docs? |
Pretty sure it is just a docs problem. When a user tries to follow them they result in an error. |
Yea, I copied the code from the old repository before finding this. I couldn't really get that compile without editing the example. I'll look into this if I have some free time. |
I was investigating using this library. I've had Consul running and tried to run the asyncio example script from the docs by copying and pasting it into a file.
I expected it to run but if failed and reported the following error:
The error is caused because the
put
function has an assert statement to check whether the key begins with the string '/'. However, the arguments being passed to the function are bytes which causes the error.Arguments used in other example scripts are all strings. I'm assuming that the API used to take either bytes or strings but changed to only strings at some point and this particular example script did not get updated to reflect a recent change to only use strings.
It seems like a docs update is needed.
The text was updated successfully, but these errors were encountered: