google / closure-linter

Automatically exported from code.google.com/p/closure-linter
Apache License 2.0
109 stars 37 forks source link

fixjsstyle throws error in python 3.1 #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Install and run on OSX 10.6 with Python 3.1 (installed from ports)
2. # fixjsstyle somefile.js

Traceback (most recent call last):
  File "/usr/local/bin/fixjsstyle", line 8, in <module>
    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

No problem running the gjslint binary.

Original issue reported on code.google.com by aristede...@gmail.com on 30 Aug 2010 at 10:07

GoogleCodeExporter commented 9 years ago
This problem is not restricted to Python 3.1.  It also happens under OSX 10.6.4 
when using the current Apple supplied version of Python (2.6.1)

Original comment by cali...@gmail.com on 31 Aug 2010 at 9:51

GoogleCodeExporter commented 9 years ago
I believe 
http://code.google.com/p/closure-linter/source/browse/trunk/closure_linter/fixjs
style.py#36 should read: 

    argv = flags.FLAGS(sys.argv)

Original comment by southgate on 1 Sep 2010 at 12:41

GoogleCodeExporter commented 9 years ago
@southgate I can confirm the workaround, works beautiful.

Pylint would've helped.

Original comment by filip.noetzel on 1 Sep 2010 at 9:47

GoogleCodeExporter commented 9 years ago
I have:
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) 
[GCC 4.4.3] on linux2
but the same problem

/tmp$ fixjsstyle system.js 
Traceback (most recent call last):
  File "/usr/local/bin/fixjsstyle", line 9, in <module>
    load_entry_point('closure-linter==2.2.1', 'console_scripts', 'fixjsstyle')()
  File "/usr/local/lib/python2.6/dist-packages/closure_linter-2.2.1-py2.6.egg/closure_linter/fixjsstyle.py", line 38, in main
    files = fileflags.GetFileList(argv, 'JavaScript', ['.js'])
  File "/usr/local/lib/python2.6/dist-packages/closure_linter-2.2.1-py2.6.egg/closure_linter/common/simplefileflags.py", line 186, in GetFileList
    return sorted(GetAllSpecifiedFiles(argv, suffixes))
  File "/usr/local/lib/python2.6/dist-packages/closure_linter-2.2.1-py2.6.egg/closure_linter/common/simplefileflags.py", line 126, in GetAllSpecifiedFiles
    files = _GetUserSpecifiedFiles(argv, suffixes)
  File "/usr/local/lib/python2.6/dist-packages/closure_linter-2.2.1-py2.6.egg/closure_linter/common/simplefileflags.py", line 76, in _GetUserSpecifiedFiles
    files = argv[1:] or []
TypeError: 'NoneType' object is unsubscriptable

Original comment by sxe.fu...@gmail.com on 2 Sep 2010 at 9:46

GoogleCodeExporter commented 9 years ago
I also confirm this issue over Python 2.6.5.

Original comment by 241...@gmail.com on 2 Sep 2010 at 2:23

GoogleCodeExporter commented 9 years ago
Confirm bug at this environment:

$ python --version
Python 2.6.5
$ uname -a
Linux ZozoX200 2.6.32-24-generic-pae #42-Ubuntu SMP Fri Aug 20 15:37:22 UTC 
2010 i686 GNU/Linux

Also confirm workaround by southgate. It works for me.

Original comment by zoz...@gmail.com on 2 Sep 2010 at 5:32

GoogleCodeExporter commented 9 years ago
Fixed the typo in fixjsstyle.py. Thank you everyone for filing the issue and 
reporting the fix. This should be fixed as of GJsLint version 2.2.4, svn 
revision 4.

Original comment by a...@google.com on 3 Sep 2010 at 12:34

GoogleCodeExporter commented 9 years ago
Issue 6 has been merged into this issue.

Original comment by a...@google.com on 3 Sep 2010 at 12:36