JessicaTegner / pypandoc

Thin wrapper for "pandoc" (MIT)
http://pypi.python.org/pypi/pypandoc/
Other
843 stars 108 forks source link

Need to use glob.escape when convert file with name like '[0].txt' #336

Closed shutaozhenzhen closed 10 months ago

shutaozhenzhen commented 1 year ago

Have problem in using pypandoc with path like '[0].txt', baceuse glob.glob returns [] and cause format = _identify_format_from_path(discovered_source_files[0], format) index out of range

Seems need to use glob.escape, which returns ['[[]0].txt'].

JessicaTegner commented 10 months ago

Don't exactly know what you are asking for here, so I'm going to close this for now.

shutaozhenzhen commented 10 months ago

Don't exactly know what you are asking for here, so I'm going to close this for now.

First, can pypandoc fix this problem that using pypandoc with path like '[0].txt' need to add glob.escape in code? Second, if can't, I think this problem worth to be explained in pypandoc's document, that if someone is dealing file like '[0].txt', they need to use glob.escape, like output = pypandoc.convert_file(glob.escape('[0].txt'), 'rst'). Third, if still can't, I add this issue to help people who face this problem, and want to find solution in github issue like me.