Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot load multi-file CSV sheet file in a directory containing '++' in its name #56

Open
danchr opened this issue Sep 4, 2018 · 0 comments

Comments

@danchr
Copy link

danchr commented Sep 4, 2018

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:

+ 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant