I have test that's failing due to a parent directory containing “++” in its name. Apparently, pyexcel somehow tries to compile the file name as regular expression when loading a multi-book CSV sheet.
+ cd /tmp
+ rm -rf x++
+ mkdir x++
+ touch x++/x__x__0.csv
+ python -c 'import pyexcel; pyexcel.get_book(file_name='\''x++/x__x__0.csv'\'')'
+ python -c 'import pyexcel; pyexcel.get_book(file_name='\''x++/x.csv'\'')'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "…/site-packages/pyexcel/core.py", line 48, in get_book
book_stream = sources.get_book_stream(**keywords)
File "…/site-packages/pyexcel/internal/core.py", line 33, in get_book_stream
sheets = a_source.get_data()
File "…/site-packages/pyexcel/plugins/sources/file_input.py", line 39, in get_data
sheets = self.__parser.parse_file(self.__file_name, **self._keywords)
File "…/site-packages/pyexcel/plugins/parsers/excel.py", line 18, in parse_file
return self._parse_any(file_name, **keywords)
File "…/site-packages/pyexcel/plugins/parsers/excel.py", line 39, in _parse_any
sheets = get_data(anything, file_type=file_type, **keywords)
File "…/site-packages/pyexcel_io/io.py", line 71, in get_data
afile, file_type=file_type, streaming=False, **keywords
File "…/site-packages/pyexcel_io/io.py", line 89, in _get_data
return load_data(**keywords)
File "…/site-packages/pyexcel_io/io.py", line 187, in load_data
reader.open(file_name, **keywords)
File "…/site-packages/pyexcel_io/readers/csvr.py", line 255, in open
self._native_book = self._load_from_file()
File "…/site-packages/pyexcel_io/readers/csvr.py", line 362, in _load_from_file
result = re.match(matcher, filen)
File "…/python3.5/re.py", line 163, in match
return _compile(pattern, flags).match(string)
File "…/python3.5/re.py", line 293, in _compile
p = sre_compile.compile(pattern, flags)
File "…/python3.5/sre_compile.py", line 536, in compile
p = sre_parse.parse(p, flags)
File "…/python3.5/sre_parse.py", line 829, in parse
p = _parse_sub(source, pattern, 0)
File "…/python3.5/sre_parse.py", line 437, in _parse_sub
itemsappend(_parse(source, state, nested + 1))
File "…/python3.5/sre_parse.py", line 641, in _parse
source.tell() - here + len(this))
sre_constants.error: multiple repeat at position 2
I have test that's failing due to a parent directory containing “++” in its name. Apparently,
pyexcel
somehow tries to compile the file name as regular expression when loading a multi-book CSV sheet.A small test case: