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

connection.py:397, write_binary_str, 'NoneType' object has no attribute 'encode' #48

Open
jovezhong opened this issue Sep 25, 2024 · 1 comment
Assignees

Comments

@jovezhong
Copy link
Collaborator

While I am testing the dbt plugin, I hit the issue in proton_driver/connection.py:397: in send_hello

/Users/jove/Dev/py310-dbt18-env/lib/python3.10/site-packages/proton_driver/connection.py:397: in send_hello
    write_binary_str(self.database, self.fout)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

text = None, buf = <proton_driver.bufferedwriter.BufferedSocketWriter object at 0x121f2dcb0>

    def write_binary_str(text, buf):
>       text = text.encode('utf-8')
E       AttributeError: 'NoneType' object has no attribute 'encode'

/Users/jove/Dev/py310-dbt18-env/lib/python3.10/site-packages/proton_driver/writer.py:15: AttributeError

I tried both Python 3.10 and 3.12, both 0.2.8 and 0.2.10. This can be reproduced with pytest --log-cli-level=DEBUG tests/functional/test_proton.py in the dbt-proton repo. But I will try to extract it and reproduce this without dbt.

@jovezhong
Copy link
Collaborator Author

The reason is the database can be None. In that case it fails call the encode method. Should check whether the text is none.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants