mtxr / SublimeText-SQLTools

SQLTools for Sublime Text 3
https://code.mteixeira.dev/SublimeText-SQLTools/
GNU General Public License v3.0
177 stars 40 forks source link

AttributeError: 'function' object has no attribute 'encode' #180

Closed 441211324 closed 6 years ago

441211324 commented 6 years ago

select database; control+ee; select * from user limit 10;

Issue Type

Feature Request |

Description

Exception in thread Thread-22674: Traceback (most recent call last): File "./python3.3/threading.py", line 901, in _bootstrap_inner File "/Users/yuegang/Library/Application Support/Sublime Text 3/Packages/SQLTools/SQLToolsAPI/Command.py", line 92, in run results, errors = self.process.communicate(input=self.query.encode(self.encoding)) AttributeError: 'function' object has no attribute 'encode'

Version

$ python -V Python 3.6.4

$ python -V Python 2.7 None of them came into force

tkopets commented 6 years ago

After taking a quick glance at this issue, unfortunately, I was not able to reproduce it. Most probably after SQLTools package update the python sources were not completely reloaded and this might be causing the issue. First of all, did you had SQLTools already installed and upgraded to v0.9.9 or freshly installed? Can you please tell, if you are still experiencing the issue after Sublime Text restart? If yes, can you please attach your SQLTools User Settings (command ST: Settings) and your SQLTools User Connections (command ST: Setup Connnections) without passwords and other sensitive info.

HJHorst commented 6 years ago

I had the exact same issue. It was gone after Sublime Text restart.

441211324 commented 6 years ago

`{ "connections": { "mysql-yingxiang": { "type" : "mysql", "host" : "123.156.228.145", "port" : 33061, "username": "esuser", "password": "aaaaaaaaaaaa", "database": "yingxiang", "encoding": "utf-8" }, "mysql-uiedutest": { "type" : "mysql", "host" : "123.156.110.135", "port" : 33061, "username": "esuser", "password": "aaaaaaaaaaaa", "database": "uiedutest", "encoding": "utf-8" }

}, "default": 'mysql-yingxiang' }`

{ "install": "messages/install.md", "0.1.6": "messages/v0.1.6.md", "0.2.0": "messages/v0.2.0.md", "0.3.0": "messages/v0.3.0.md", "0.3.1": "messages/v0.3.0.md", "0.8.2": "messages/v0.8.2.md", "0.9.0": "messages/v0.9.0.md", "0.9.1": "messages/v0.9.1.md", "0.9.2": "messages/v0.9.2.md", "0.9.3": "messages/v0.9.3.md", "0.9.4": "messages/v0.9.4.md", "0.9.5": "messages/v0.9.5.md", "0.9.6": "messages/v0.9.6.md", "0.9.7": "messages/v0.9.7.md", "0.9.8": "messages/v0.9.8.md", "0.9.9": "messages/v0.9.9.md" }

tkopets commented 6 years ago

@441211324 Do you still have the same error after Sublime Text restart (for @HJHorst restart fixed this problem)? Also, you didn't attach your SQLTools user config User\SQLTools.sublime-settings (command ST: Settings).

441211324 commented 6 years ago

@tkopets

All Thanks !

I used the houmebrew installation of MySQL, a few twists and turns, finally configured, it is a question of the command line. SQLTools.sublime-settings

{
    "cli" : {
        "mysql"   : "/usr/local/opt/mysql@5.6/bin/mysql"
    }
}

There is a conflict between local MySQL and homeborew MySQL environment variables, and I'm completely clear empty

vi ~/.zshrc
export PATH="/usr/local/opt/mysql@5.6/bin:$PATH"
source ~/.zshrc