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

Excel import broken #75

Closed
djv opened this issue May 29, 2012 · 2 comments
Closed

Excel import broken #75

djv opened this issue May 29, 2012 · 2 comments

Comments

@djv
Copy link

djv commented May 29, 2012

I'm creating an empty Databook, write it to a xls file and then trying to read it throws an Exception. The code I use is:

d = tablib.Databook()
s = tablib.Dataset()
d.add_sheet(s)
open('tablib.xls','wb').write(d.xls)
d = tablib.import_set(open('tablib.xls','rb'))

The traceback:

eaderError                               Traceback (most recent call last)
/Users/dvelkov/<ipython-input-59-072c251b8638> in <module>()
----> 1 d = tablib.import_set(open('tablib.xls','rb'))

/Library/Python/2.7/site-packages/tablib/core.pyc in import_set(stream)
    937 def import_set(stream):
    938     """Return dataset of given stream."""
--> 939     (format, stream) = detect(stream)
    940 
    941     try:

/Library/Python/2.7/site-packages/tablib/core.pyc in detect(stream)
    928     for fmt in formats.available:
    929         try:
--> 930             if fmt.detect(stream):
    931                 return (fmt, stream)
    932         except AttributeError:

/Library/Python/2.7/site-packages/tablib/formats/_yaml.pyc in detect(stream)
     56     """Returns True if given stream is valid YAML."""
     57     try:
---> 58         _yaml = yaml.load(stream)
     59         if isinstance(_yaml, (list, tuple, dict)):
     60             return True

/Library/Python/2.7/site-packages/tablib/packages/yaml/__init__.pyc in load(stream, Loader)
     55     and produce the corresponding Python object.
     56     """
---> 57     loader = Loader(stream)
     58     return loader.get_single_data()
     59 

/Library/Python/2.7/site-packages/tablib/packages/yaml/loader.pyc in __init__(self, stream)
     32 
     33     def __init__(self, stream):
---> 34         Reader.__init__(self, stream)
     35         Scanner.__init__(self)
     36         Parser.__init__(self)

/Library/Python/2.7/site-packages/tablib/packages/yaml/reader.pyc in __init__(self, stream)
    118             self.eof = False
    119             self.raw_buffer = ''
--> 120             self.determine_encoding()
    121 
    122     def peek(self, index=0):

/Library/Python/2.7/site-packages/tablib/packages/yaml/reader.pyc in determine_encoding(self)
    168                 self.raw_decode = utf_8_decode
    169                 self.encoding = 'utf-8'
--> 170         self.update(1)
    171 
    172     NON_PRINTABLE = re.compile(u'[^\x09\x0A\x0D\x20-\x7E\x85\xA0-\uD7FF\uE000-\uFFFD]')

/Library/Python/2.7/site-packages/tablib/packages/yaml/reader.pyc in update(self, length)
    198                         position = exc.start
    199                     raise ReaderError(self.name, position, character,
--> 200                             exc.encoding, exc.reason)
    201             else:
    202                 data = self.raw_buffer

ReaderError: 'utf8' codec can't decode byte #xd0: invalid continuation byte
  in "tablib.xls", position 0```
@djv
Copy link
Author

djv commented Jun 1, 2012

Should be fixed in https://github.com/kennethreitz/tablib/issues/76

@kennethreitz
Copy link
Contributor

This project is in a bit of a crisis state — it's really useful, and I use regularly. However, I wrote it several years ago and haven't touched it since. In order to get the project into a stable state I'm closing all issues and pull requests to get a "fresh slate"

Don't take this as aggressive — it's just necessary for the project to make any progress any time soon (it's pretty clear the project is effectively unmaintained at the moment). Great things to come! Please watch the GitHub logs and feel free to re-open this discussion soon. I just need to really it into a good state first.

✨ ❤️ ✨

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

3 participants