ickc/pancritic

Use as preprocessor error

Closed this issue · 4 comments

I was trying to use pancritic as a preprocessor for pandoc using
pancritic docum1.md -t markdown -m a | pandoc -s -o docum1.pdf
but got the following error.
I was planning to apply --filters in pandoc.
I am wondering the correct way of using it as a preprocessor.

Traceback (most recent call last):
File "/usr/local/bin/pancritic", line 11, in
sys.exit(cli())
File "/usr/local/lib/python2.7/site-packages/pancritic/main.py", line 137, in cli
main(*get_args())
File "/usr/local/lib/python2.7/site-packages/pancritic/main.py", line 117, in get_args
output_format = normalize_format(os.path.splitext(args.output)[1][1:])
File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 98, in splitext
return genericpath._splitext(p, sep, altsep, extsep)
File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/genericpath.py", line 99, in _splitext
sepIndex = p.rfind(sep)
AttributeError: 'NoneType' object has no attribute 'rfind'

ickc commented

Can you upload your docum1.md?

docum1.md is quite simple:

# Heading
{++add++}
{--remove--}
{>>comment<<}
content
~$ pancritic docum1.md -t markdown -m a | pandoc -s -o docum1.pdf
Traceback (most recent call last):
  File "/usr/local/bin/pancritic", line 11, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python2.7/site-packages/pancritic/main.py", line 137, in cli
    main(*get_args())
  File "/usr/local/lib/python2.7/site-packages/pancritic/main.py", line 117, in get_args
    output_format = normalize_format(os.path.splitext(args.output)[1][1:])
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 98, in splitext
    return genericpath._splitext(p, sep, altsep, extsep)
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/genericpath.py", line 99, in _splitext
    sepIndex = p.rfind(sep)
AttributeError: 'NoneType' object has no attribute 'rfind'

This might be related to #5. I don't get this particular error, but your error seems to have to do with processing the output_format, so it might just be related.

ickc commented

I just tested this case and it runs fine. But I noticed that you're using Python 2.7. Have you try using Python 3 to run that?

(In case it is really just Python 2, since Python 2 is deprecating in less than a year, I don't think it is worth spending time to fix that... Sorry, Python 2.)