You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I installed this plugin with the Package Control of ST2, but even after a restart of ST2 the plugin isn't available.
A look at the ST2 console told me the following:
Reloading plugin /Users/dennis/Library/Application Support/Sublime Text 2/Packages/Format SQL/FormatSQL.py
Traceback (most recent call last):
File "./sublime_plugin.py", line 62, in reload_plugin
File "./FormatSQL.py", line 8, in
from sqlparse import format
File "./sqlparse/init.py", line 17, in
from . import engine
File "./sqlparse/engine/init.py", line 8, in
from .. import lexer
File "./sqlparse/lexer.py", line 154
class Lexer(object, metaclass=LexerMeta):
^
SyntaxError: invalid syntax
Unfortunately I cannot update to SF3 (OS X too old) and I also have no idea of python. :(
Is there a chance to make this plugin work in ST2 again?
I'm running into some syntax error as well (ST2 v2.0.2 build 2221 on OSX 10.8.5). I had python 2.5 and it didn't work then I updated it to python 2.7 and it still doesn't work.
The error cursor is point to a different spot though:
File "./sublime_plugin.py", line 62, in reload_plugin
File "./FormatSQL.py", line 8, in
from sqlparse import format
File "./sqlparse/init.py", line 17, in
from . import engine
File "./sqlparse/engine/init.py", line 8, in
from .. import lexer
File "./sqlparse/lexer.py", line 154
class Lexer(object, metaclass=LexerMeta):
^
I investigated a little further and found that the cause is the migration from the Python 2 way of defining meta classes with a __metaclass__ attribute to the Python 3 syntax which uses an additional metaclass parameter in the class definition. Unfortunately the Python 2 compiler considers this as a syntax error and even worse the Python 3 compiler just ignores the old __metaclass__ attribute. There is a good explanation at http://mikewatkins.ca/2008/11/29/python-2-and-3-metaclasses/ that describes this and suggests a backward compatible solution that works on Python 2 and 3.
Simple solution, at least for Sublime Text 2: Clone the latest version of sqlparse (https://github.com/andialbrecht/sqlparse) and then replace the sqlparse folder in this plugin with the copy from the clone you just made; restart sublime and life should be good.
Activity
akloeber commentedon Oct 4, 2013
Hi there,
I ran into the same error too after installing FormatSQL an hour ago (ST 2.0.2, Build 2221, Mac OSX 10.8.5, Python 2.7.2).
Greets
Andreas
joaquimpedrooliveira commentedon Oct 9, 2013
Hello all,
Same problem here using Ubuntu 10.10, ST 2.0.2, build 2221. Installed FormatSQL from package manager.
Any tips?
ken-maestro commentedon Oct 9, 2013
I'm running into some syntax error as well (ST2 v2.0.2 build 2221 on OSX 10.8.5). I had python 2.5 and it didn't work then I updated it to python 2.7 and it still doesn't work.
The error cursor is point to a different spot though:
File "./sublime_plugin.py", line 62, in reload_plugin
File "./FormatSQL.py", line 8, in
from sqlparse import format
File "./sqlparse/init.py", line 17, in
from . import engine
File "./sqlparse/engine/init.py", line 8, in
from .. import lexer
File "./sqlparse/lexer.py", line 154
class Lexer(object, metaclass=LexerMeta):
^
Thanks
akloeber commentedon Oct 12, 2013
I investigated a little further and found that the cause is the migration from the Python 2 way of defining meta classes with a
__metaclass__attribute to the Python 3 syntax which uses an additionalmetaclassparameter in the class definition. Unfortunately the Python 2 compiler considers this as a syntax error and even worse the Python 3 compiler just ignores the old__metaclass__attribute. There is a good explanation at http://mikewatkins.ca/2008/11/29/python-2-and-3-metaclasses/ that describes this and suggests a backward compatible solution that works on Python 2 and 3.d42ohpaz commentedon Nov 1, 2013
Simple solution, at least for Sublime Text 2: Clone the latest version of sqlparse (https://github.com/andialbrecht/sqlparse) and then replace the sqlparse folder in this plugin with the copy from the clone you just made; restart sublime and life should be good.
jaredbeck commentedon Feb 7, 2014
@dohpaz42 thanks, worked for me. Make sure to use https://github.com/andialbrecht/sqlparse/tree/master/sqlparse not https://github.com/andialbrecht/sqlparse
New-High-Score commentedon Feb 17, 2014
thanks @dohpaz42, you're a lifesaver!