Inaccurate parsing of relative paths on files with no extensions
xiongchiamiov opened this issue · comments
[$]> pycco ../lastfm-tail/bin/lastfm-tail
Traceback (most recent call last):
File "/Users/pearson/Documents/docdrop/env/bin/pycco", line 8, in <module>
load_entry_point('Pycco==0.3.0', 'console_scripts', 'pycco')()
File "/Users/pearson/Documents/docdrop/env/lib/python2.6/site-packages/pycco/main.py", line 480, in main
process(sources, outdir=opts.outdir, preserve_paths=opts.paths)
File "/Users/pearson/Documents/docdrop/env/lib/python2.6/site-packages/pycco/main.py", line 417, in process
next_file()
File "/Users/pearson/Documents/docdrop/env/lib/python2.6/site-packages/pycco/main.py", line 411, in next_file
f.write(generate_documentation(s, preserve_paths=preserve_paths, outdir=outdir))
File "/Users/pearson/Documents/docdrop/env/lib/python2.6/site-packages/pycco/main.py", line 46, in generate_documentation
sections = parse(source, fh.read())
File "/Users/pearson/Documents/docdrop/env/lib/python2.6/site-packages/pycco/main.py", line 66, in parse
language = get_language(source)
File "/Users/pearson/Documents/docdrop/env/lib/python2.6/site-packages/pycco/main.py", line 324, in get_language
return languages[ source[source.rindex("."):] ]
KeyError: './lastfm-tail/bin/lastfm-tail'
The problem is with source.rindex(".")
- when a file doesn't have an extension, this splits on the ..
part of the relative path.
Should be resolved by ea57616.