TypeError: 'NoneType' object is unsubscriptable

214 views
Skip to first unread message

jAndy

unread,
Sep 1, 2010, 2:27:03 AM9/1/10
to Closure Linter Discuss
Hi,

I've installed the GJsLint on my Debian Lenny 5.0.5 system. Python
version is 2.5.2.

gjslint foobar.js works just fine and displays errors/warnings within
foobar.js, but using

fixjsstyle --strict super.js

throws


Traceback (most recent call last):
File "/usr/bin/fixjsstyle", line 8, in <module>
load_entry_point('closure-linter==2.2.1', 'console_scripts',
'fixjsstyle')()
File "build/bdist.linux-x86_64/egg/closure_linter/fixjsstyle.py",
line 38, in main
File "build/bdist.linux-x86_64/egg/closure_linter/common/
simplefileflags.py", line 186, in GetFileList
File "build/bdist.linux-x86_64/egg/closure_linter/common/
simplefileflags.py", line 126, in GetAllSpecifiedFiles
File "build/bdist.linux-x86_64/egg/closure_linter/common/
simplefileflags.py", line 76, in _GetUserSpecifiedFiles
TypeError: 'NoneType' object is unsubscriptable

On more big & complex js files, even "gjslint foobar-complex.js"
throws

Traceback (most recent call last):
File "build/bdist.linux-x86_64/egg/closure_linter/checkerbase.py",
line 190, in CheckLines
self.__metadata_pass.Process(token)
File "build/bdist.linux-x86_64/egg/closure_linter/
ecmametadatapass.py", line 395, in Process
self._ProcessToken()
File "build/bdist.linux-x86_64/egg/closure_linter/
ecmametadatapass.py", line 412, in _ProcessToken
context = (self._ProcessContext() or self._context)
File "build/bdist.linux-x86_64/egg/closure_linter/
ecmametadatapass.py", line 291, in _ProcessContext
if keyword_token.string in ('if', 'for', 'while'):
AttributeError: 'NoneType' object has no attribute 'string'
0 files checked, no errors found.

Am I doing anything wrong here?

Steven Hall

unread,
Sep 1, 2010, 3:49:55 AM9/1/10
to Closure Linter Discuss
Yup, I'm getting this error too. I'm on Windows, using Python 2.7.

I hit this whenever I use fixjsstyle. I haven't had any problems using
gjslint, though.

Traceback (most recent call last):
File "C:\Python27\Scripts\fixjsstyle-script.py", line 8, in <module>
load_entry_point('closure-linter==2.2.1', 'console_scripts',
'fixjsstyle')()
File "build\bdist.win32\egg\closure_linter\fixjsstyle.py", line 38,
in main
File "build\bdist.win32\egg\closure_linter\common
\simplefileflags.py", line 186, in GetFileList
File "build\bdist.win32\egg\closure_linter\common
\simplefileflags.py", line 126, in GetAllSpecifiedFiles
File "build\bdist.win32\egg\closure_linter\common
\simplefileflags.py", line 76, in _GetUserSpecifiedFiles
TypeError: 'NoneType' object is not subscriptable

wjdix

unread,
Sep 1, 2010, 6:52:07 PM9/1/10
to Closure Linter Discuss
I am also getting this error on OS X

Charl van Niekerk

unread,
Sep 1, 2010, 8:49:10 PM9/1/10
to Closure Linter Discuss
Same on Ubuntu 10.04 with Python 2.6.5:

http://pastebin.com/UZpDbtyr

leeight的马甲

unread,
Sep 1, 2010, 11:51:01 PM9/1/10
to Closure Linter Discuss
typo error, you can fix in change
/usr/lib/python2.6/site-packages/closure_linter-2.2.1-py2.6.egg/
closure_linter/fixjsstyle.py
change argf to argv at the 36 line

Andy Perelson

unread,
Sep 2, 2010, 1:34:38 AM9/2/10
to closure-lin...@googlegroups.com
Thanks for the feedback on these two issues, and the fix suggestion for the problems with fixjsstyle.py. I'll try to get a fixed version of GJsLint out soon, and I can update this thread once that is done.

Thank you,

Andy

Steven Hall

unread,
Sep 2, 2010, 3:28:39 AM9/2/10
to Closure Linter Discuss
I thought I'd just add some more instructions for this. I'm on
Windows, though it should work across other platforms.

When you call easy_install from the command line, add the -Z flag.
This will ensure the Linter is unzipped and you can access the files.
So that's:

Linux:
$ cd /tmp
/tmp$ sudo easy_install -Z http://closure-linter.googlecode.com/files/closure_linter-latest.tar.gz

OS X:
$ sudo easy_install -Z http://closure-linter.googlecode.com/files/closure_linter-latest.tar.gz

Windows:
> easy_install -Z http://closure-linter.googlecode.com/files/closure_linter-latest.tar.gz

That should then create a directory in your site-packages directory
called closure_linter... (Followed by a version number & a Python
version).egg, and you can follow leeight's instructions to fix the
bug.

FGRibreau

unread,
Sep 2, 2010, 5:02:33 AM9/2/10
to Closure Linter Discuss
Even with Closure-linter v2.2.1 I've got this 2 errors:

I always got this bug with "fixjsstyle" -> "
Traceback (most recent call last):
File "/usr/local/bin/fixjsstyle", line 8, in
load_entry_point('closure-linter==2.2.1', 'console_scripts',
'fixjsstyle')()
File "build/bdist.macosx-10.6-universal/egg/closure_linter/
fixjsstyle.py", line 38, in main
File "build/bdist.macosx-10.6-universal/egg/closure_linter/common/
simplefileflags.py", line 186, in GetFileList
File "build/bdist.macosx-10.6-universal/egg/closure_linter/common/
simplefileflags.py", line 126, in GetAllSpecifiedFiles
File "build/bdist.macosx-10.6-universal/egg/closure_linter/common/
simplefileflags.py", line 76, in _GetUserSpecifiedFiles
TypeError: 'NoneType' object is unsubscriptable"

And sometimes this one with gjslint -> "
Traceback (most recent call last):
File "build/bdist.macosx-10.6-universal/egg/closure_linter/
checkerbase.py", line 190, in CheckLines
self.__metadata_pass.Process(token)
File "build/bdist.macosx-10.6-universal/egg/closure_linter/
ecmametadatapass.py", line 395, in Process
self._ProcessToken()
File "build/bdist.macosx-10.6-universal/egg/closure_linter/
ecmametadatapass.py", line 412, in _ProcessToken
context = (self._ProcessContext() or self._context)
File "build/bdist.macosx-10.6-universal/egg/closure_linter/
ecmametadatapass.py", line 291, in _ProcessContext
if keyword_token.string in ('if', 'for', 'while'):
AttributeError: 'NoneType' object has no attribute 'string'"

On 2 sep, 09:28, Steven Hall <stvh...@gmail.com> wrote:
> I thought I'd just add some more instructions for this. I'm on
> Windows, though it should work across other platforms.
>
> When you call easy_install from the command line, add the -Z flag.
> This will ensure the Linter is unzipped and you can access the files.
> So that's:
>
> Linux:
> $ cd /tmp
> /tmp$ sudo easy_install -Zhttp://closure-linter.googlecode.com/files/closure_linter-latest.tar.gz
>
> OS X:
> $ sudo easy_install -Zhttp://closure-linter.googlecode.com/files/closure_linter-latest.tar.gz
>
> Windows:
>
> > easy_install -Zhttp://closure-linter.googlecode.com/files/closure_linter-latest.tar.gz

Steven Hall

unread,
Sep 2, 2010, 5:58:16 AM9/2/10
to Closure Linter Discuss
Did you apply the fix that leeight posted? There hasn't been an
official release from Google, so 2.2.1 without the fix will still
reproduce the error.

The fix proposed here is just a temporary thing until Andy releases
the fixed version.

FGRibreau

unread,
Sep 2, 2010, 7:44:05 AM9/2/10
to Closure Linter Discuss
There is no "site-packages" folder in my "/usr/lib/python2.6/" dir.
And I can't find any file named "closure_linter********.egg" (using
spotlight & $find / -name closure)

I've MacOS 10.6.4 with Python 2.5 & 2.6 installed.

Дмитрий Петров

unread,
Sep 2, 2010, 7:50:58 AM9/2/10
to closure-lin...@googlegroups.com
try /usr/local/lib/python2.6/dist-packages/closure_linter-2.2.1-py2.6.egg

2010/9/2 FGRibreau <per...@gmail.com>:

--
С уважением, Петров Дмитрий

Andy Perelson

unread,
Sep 2, 2010, 8:31:41 PM9/2/10
to closure-lin...@googlegroups.com
I've updated GJsLint to version 2.2.4, hopefully both the issues raised in this thread are fixed for everyone.

Thanks,

Andy
Reply all
Reply to author
Forward
0 new messages