diff options
author | Amjith Ramanujam <amjith@netflix.com> | 2021-01-16 08:54:09 -0800 |
---|---|---|
committer | Amjith Ramanujam <amjith@netflix.com> | 2021-01-16 08:54:09 -0800 |
commit | 55f0fac471ea2be76e00a35a1f385c0327710580 (patch) | |
tree | 290f8e9d3fced8eef074f49e66aa65bbc657ff39 | |
parent | 17906f9af635fa714e9b792c4a9eb2b3a40b89a0 (diff) |
Make int parsing of port more robust.amjith/int_port
-rwxr-xr-x | mycli/main.py | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/mycli/main.py b/mycli/main.py index 32718db..f2b2fd8 100755 --- a/mycli/main.py +++ b/mycli/main.py @@ -397,11 +397,7 @@ class MyCli(object): socket = socket or cnf['socket'] or guess_socket_location() user = user or cnf['user'] or os.getenv('USER') host = host or cnf['host'] - try: - port = port or int(cnf['port']) - except ValueError as e: - self.echo("Error: Invalid port number: '{0}'.".format(cnf['port']), - err=True, fg='red') + port = int(port or cnf['port'] or 3306) ssl = ssl or {} passwd = passwd if isinstance(passwd, str) else cnf['password'] |