Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3 example on the getting started #1395

Closed
bjonnh opened this issue Mar 15, 2018 · 1 comment
Closed

Python 3 example on the getting started #1395

bjonnh opened this issue Mar 15, 2018 · 1 comment
Assignees
Labels
doc Your PR contains doc changes, no matter whether the changes are in markdown or code files.

Comments

@bjonnh
Copy link

bjonnh commented Mar 15, 2018

Expected behavior

Working "getting-started" guide example.

Actual behavior

The script producer script is raising an error:

Traceback (most recent call last):
  File "pulsar_pub.py", line 7, in <module>
    producer.send('hello-pulsar-%d' % i)
  File "./test/pulsar/venv/lib/python3.6/site-packages/pulsar.py", line 568, in send
    replication_clusters, disable_replication)
  File "./test/pulsar/venv/lib/python3.6/site-packages/pulsar.py", line 629, in _build_msg
    _check_type(bytes, content, 'content')
  File "./test/pulsar/venv/lib/python3.6/site-packages/pulsar.py", line 803, in _check_type
    raise ValueError("Argument %s is expected to be of type '%s'" % (name, var_type.__name__))
ValueError: Argument content is expected to be of type 'bytes'

Steps to reproduce

Just try the examples on page: https://pulsar.apache.org/docs/latest/getting-started/docker/
with Python3.

Steps to resolve

From a client side, replaced the send by:

producer.send(('hello-pulsar-%d' % i).encode('utf8')) 

This should work with python2 too, at least recent versions of it.

System configuration

Pulsar version: Docker version 1.22.0-incubating
Pulsar-client version: pulsar-client==1.22.0 (from pip)

@merlimat merlimat added the doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. label Mar 16, 2018
@merlimat merlimat self-assigned this Mar 16, 2018
@merlimat
Copy link
Contributor

Thanks @bjonnh for reporting this. Will fix the docs and examples

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Your PR contains doc changes, no matter whether the changes are in markdown or code files.
Projects
None yet
Development

No branches or pull requests

2 participants