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

AttributeError: 'NoneType' object has no attribute 'encode' #120

Closed
guettli opened this issue Oct 11, 2019 · 1 comment
Closed

AttributeError: 'NoneType' object has no attribute 'encode' #120

guettli opened this issue Oct 11, 2019 · 1 comment

Comments

@guettli
Copy link
Contributor

guettli commented Oct 11, 2019

According to #91 this was fixed in 1.9.94, but I am still seeing this (or similar) error message:

Traceback (most recent call last):
 File "/home/modlink_cok_q/src/modlink/modlink/models/remote.py", line 103, in call
 return self.connection.call(*args, **kwargs)
 File "src/pyrfc/_pyrfc.pyx", line 409, in pyrfc._pyrfc.Connection.call
 File "src/pyrfc/_pyrfc.pyx", line 1641, in pyrfc._pyrfc.fillFunctionParameter
 File "src/pyrfc/_pyrfc.pyx", line 1692, in pyrfc._pyrfc.fillVariable
 File "src/pyrfc/_pyrfc.pyx", line 1668, in pyrfc._pyrfc.fillTable
 File "src/pyrfc/_pyrfc.pyx", line 1653, in pyrfc._pyrfc.fillStructureField
 File "src/pyrfc/_pyrfc.pyx", line 1710, in pyrfc._pyrfc.fillVariable
 File "src/pyrfc/_pyrfc.pyx", line 1817, in pyrfc._pyrfc.fillString
AttributeError: 'NoneType' object has no attribute 'encode'

If the string is optional, I think it should be valid do pass in my_string=None which should have the same effect as don't providing my_string.

If it is not optional and the RFC has a default for it, the default should get used, if you provide my_string=None

bsrdjan added a commit that referenced this issue Oct 22, 2019
@bsrdjan
Copy link
Contributor

bsrdjan commented Nov 4, 2019

Thanks for the feature request. None is rejected because users appreciate catching type errors when None unintentionally passed instead of string, or any other parameter/variable type. Skipping None values in inbound processing could be considered as option, in future releases. The error message is now more informative.

@bsrdjan bsrdjan closed this as completed Nov 7, 2019
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