-
Notifications
You must be signed in to change notification settings - Fork 40
getOptionsForSgdbCli -- AttributeError: 'NoneType' object has no attribute 'get' #51
Comments
Ach, good, it is a connection issue. I was wondering why do I see
|
@Demetrio92 does it still happening? Couldn't reproduce this error here, Mac, windows and Linux were ok. |
@mtxr well, last commit is 29th of October, this issue was created on 8th novermber.
should I test some other branch? |
My
to sum it up, even the basic functionality, like establishing connection and executing a query doesn't work. I am quite sure that a critical bug :) |
postgresql requires pgpass file. Your connection file uses a password. See https://github.com/mtxr/SQLTools/blob/master/SQLToolsConnections.sublime-settings |
Just spent some time on this issue for Mac (OS X 10.11.6 El Capitain). SQLTools is reading the settings from the defaults and not from the user folder due to a path error. This is because in the SQLTools.py script the user path (USER_FOLDER) reverts to null. Installing the package Fix Mac Path resolved this issue for me: https://github.com/int3h/SublimeFixMacPath. |
I have the same issue with mysql. OS : Win 10 Pro My
And the console result :
|
Sure thing, I totally forgot about the authentification method postgres uses, in fact, password parameter is completely immaterial since
Also, on my windows machine I should substitute All these things would've popped up, if SQLTools actually made it to the step "send the query into psql console". I would've fixed them myself without any external help. As you can see from the traceback I provided it simply fails to load options, but I am a bit confused on the cause of this error. |
A day of debugging beatufully written, modular, but completely uncommented python code and I found it. class Settings(Storage):
pass ? -- Now to the error. self.cli = settings.get('cli')[options['type']]
cli_path = shutil.which(self.cli) (from Connection.py __init__) if cli_path is None:
Log((
"'{0}' could not be found.\n\n" +
"Please set the '{0}' path in your SQLTools settings " +
"before continue.").format(self.cli))
return which
Don't ask me why def Log(message):
return Logger.debug(message) Maybe it's b/c of class Logger:
logging = False ? -- Why does the problem occur? "cli" : {
"mysql" : "mysql",
"pgsql" : "C:/<complicated_folder_structure>/pgadmin-III/1.22/psql",
"oracle" : "sqlplus", As you might guess, >>> print(self.cli)
C:/<complicated_folder_structure>/pgadmin-III/1.22/psql Interestingly >>> type(shutil.which('C:/<complicated_folder_structure>/pgadmin-III/1.22/psql'))
<class 'NoneType'>
>>> type(shutil.which('C:\\<complicated_folder_structure>\\pgadmin-III\\1.22\\psql'))
<class 'NoneType'>
>>> type(shutil.which('psql'))
<class 'NoneType'>
>>> shutil.which('python')
'C:\\<complicated_folder_structure>\\python\\python.EXE' even though from the user@PC MINGW64 /
$ which C:/<complicated_folder_structure>/pgadmin-III/1.22/psql
C:/<complicated_folder_structure>/pgadmin-III/1.22/psql so, there is a simple bug in -- WORKAROUND
self.cli = settings.get('cli')[options['type']]
# cli_path = shutil.which(self.cli)
cli_path = self.cli -- A Long-Run Solutionimport this
...
Errors should never pass silently.
Unless explicitly silenced.
... This also applies to try:
query = self.getOptionsForSgdbCli()['queries']['columns']['query']
self.Command.createAndRun(self.builArgs('columns'), query, cb)
except Exception:
pass try:
query = self.getOptionsForSgdbCli()['queries']['functions']['query']
self.Command.createAndRun(self.builArgs(
'functions'), query, cb)
except Exception:
pass and many others. |
@Demetrio92 great job! I'll investigate it as soon as a have some time. But your comment already helped me a lot but it will take some time, ok? Thanks! |
@Demetrio92 Also, I should start commenting the code 🤒 , sorry :P |
@mtxr You should probably drop something into the readme for OSX users. @mvaneggermond nice find.
|
@mvaneggermond could you make a pull request updating the README with your findings? |
The most safe way is still to add cli-tools (psql, mysql, whatever) to your path. |
Sure, but you need to add me as a collaborator I believe?
Otherwise, feel free to add this to the readme
### Using SQLTools with Mac OS X
Sublime Text has its PATH set from launchctl, not by your shell. Binaries installed by packages such as homebrew, for instance `Postgresql`, cannot be found by Sublime Text and results in a null pointer exception thrown by `SQLTools`. Installing the package `Fix Mac Path` resolves this issue. This package can be downloaded [here](https://github.com/int3h/SublimeFixMacPath).
On 3 Mar 2017, at 9:59 AM, Matheus Teixeira <notifications@github.com<mailto:notifications@github.com>> wrote:
@mvaneggermond<https://github.com/mvaneggermond> could you make a pull request updating the README with your findings?
Helps a lot :D
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#51 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AHCgdhtuc7qmDP2yudvhq1UsG4sAC8oYks5rh3QHgaJpZM4Ksv0C>.
|
All done! Thanks mate :D |
The changes include raising an apropriate Exception if DB cli binary could not be found, with clear next steps on how to fix the issue. Upon creating a connection, if such Exception is encountered a sublime status message is displayed to indicate this problem. fixes #74, fixes #82 related #39, #41, #48, #51
The changes include raising an apropriate Exception if DB cli binary could not be found, with clear next steps on how to fix the issue. Upon creating a connection, if such Exception is encountered a sublime status message is displayed to indicate this problem. fixes mtxr#74, fixes mtxr#82 related mtxr#39, mtxr#41, mtxr#48, mtxr#51
I cannot execute an sql statement. The connections selector seems to be working though.
Traceback:
Just a reminder: we had something similar in the issue #45.
P.s.
I am on:
e7470ee ("Bump version: 0.6.5 to 0.6.6", 2016-10-29)
My config is already listed in issue #41
The text was updated successfully, but these errors were encountered: