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

To avoid AttributeError in function _request_authentication(self) #104

Merged
merged 1 commit into from Sep 5, 2016

Conversation

ttlttl
Copy link
Contributor

@ttlttl ttlttl commented Sep 3, 2016

Hi,

When I use aiomysql 0.0.8 on Window10 x64 using Python3.5.2 to connect mysql server( version 5.1.73) on Centos6.4 x64, I got:

_File "G:\git\aiowebapp.env\lib\site-packages\aiomysql\connection.py", line 657, in _request_authentication
if self._auth_plugin_name in ('', 'mysql_native_password'):
AttributeError: 'Connection' object has no attribute 'auth_plugin_name'

I checked the Server Greeting wirshark cap, found the "PLUGIN_AUTH" bit in "server capabilities" is 0, which means "self.server_capabilities & CLIENT.PLUGIN_AUTH" is False in function "_get_server_information(self)", so attribute 'auth_plugin_name' is undefined here.
And then the "AttributeError" occur in _request_authentication(self): if self.server_capabilities & CLIENT.PLUGIN_AUTH:

And when I do this fix, the aiomysql works well!

Best Regards
Mingming

@coveralls
Copy link

coveralls commented Sep 3, 2016

Coverage Status

Coverage increased (+0.003%) to 95.108% when pulling 21025e0 on ttlttl:Fix-auth-error into 0aa221e on aio-libs:master.

1 similar comment
@coveralls
Copy link

coveralls commented Sep 3, 2016

Coverage Status

Coverage increased (+0.003%) to 95.108% when pulling 21025e0 on ttlttl:Fix-auth-error into 0aa221e on aio-libs:master.

@@ -756,6 +756,9 @@ def _get_server_information(self):
i += salt_len

i += 1

self._auth_plugin_name = ''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch! could you move this line to __init__ block ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

@coveralls
Copy link

coveralls commented Sep 5, 2016

Coverage Status

Coverage increased (+0.003%) to 95.108% when pulling d02b4a2 on ttlttl:Fix-auth-error into 0aa221e on aio-libs:master.

@jettify jettify merged commit ad62a32 into aio-libs:master Sep 5, 2016
@jettify
Copy link
Member

jettify commented Sep 5, 2016

Thanks!

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

Successfully merging this pull request may close these issues.

None yet

3 participants