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

Can't upload CSV in Apache Superset #6587

Closed
3 tasks done
shaguntyagi opened this issue Jan 2, 2019 · 14 comments
Closed
3 tasks done

Can't upload CSV in Apache Superset #6587

shaguntyagi opened this issue Jan 2, 2019 · 14 comments
Labels
!deprecated-label:bug Deprecated label - Use #bug instead v0.28

Comments

@shaguntyagi
Copy link

shaguntyagi commented Jan 2, 2019

Make sure these boxes are checked before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven't found one similar.

Superset version

0.28.1

Issue

I am trying to upload CSV file in Superset but getting this error: TypeError: Object of type ParserError is not JSON serializable.

The traceback is as followed:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1997, in call
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1985, in wsgi_app
response = self.handle_exception(e)
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1540, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.6/dist-packages/flask/_compat.py", line 33, in reraise
raise value
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1615, in full_dispatch_request
return self.finalize_request(rv)
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1632, in finalize_request
response = self.process_response(response)
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1858, in process_response
self.save_session(ctx.session, response)
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 924, in save_session
return self.session_interface.save_session(self, session, response)
File "/usr/local/lib/python3.6/dist-packages/flask/sessions.py", line 363, in save_session
val = self.get_signing_serializer(app).dumps(dict(session))
File "/usr/local/lib/python3.6/dist-packages/itsdangerous/serializer.py", line 166, in dumps
payload = want_bytes(self.dump_payload(obj))
File "/usr/local/lib/python3.6/dist-packages/itsdangerous/url_safe.py", line 42, in dump_payload
json = super(URLSafeSerializerMixin, self).dump_payload(obj)
File "/usr/local/lib/python3.6/dist-packages/itsdangerous/serializer.py", line 133, in dump_payload
return want_bytes(self.serializer.dumps(obj, **self.serializer_kwargs))
File "/usr/local/lib/python3.6/dist-packages/flask/sessions.py", line 85, in dumps
return json.dumps(_tag(value), separators=(',', ':'))
File "/usr/local/lib/python3.6/dist-packages/flask/json.py", line 167, in dumps
rv = _json.dumps(obj, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/simplejson/init.py", line 399, in dumps
**kw).encode(obj)
File "/usr/local/lib/python3.6/dist-packages/simplejson/encoder.py", line 296, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/local/lib/python3.6/dist-packages/simplejson/encoder.py", line 378, in iterencode
return _iterencode(o, 0)
File "/usr/local/lib/python3.6/dist-packages/flask/json.py", line 81, in default
return _json.JSONEncoder.default(self, o)
File "/usr/local/lib/python3.6/dist-packages/simplejson/encoder.py", line 273, in default
o.class.name)
TypeError: Object of type ParserError is not JSON serializable

@KilimAnnejaro
Copy link
Contributor

KilimAnnejaro commented Jan 5, 2019

Hi,
I can confirm that in the most recent version, I am getting what I suspect is a similar error, with this stacktrace:

File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1816, in full_dispatch_request
return self.finalize_request(rv)
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1833, in finalize_request
response = self.process_response(response)
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2114, in process_response
self.session_interface.save_session(self, ctx.session, response)
File "/usr/local/lib/python3.6/site-packages/flask/sessions.py", line 375, in save_session
val = self.get_signing_serializer(app).dumps(dict(session))
File "/usr/local/lib/python3.6/site-packages/itsdangerous.py", line 565, in dumps
payload = want_bytes(self.dump_payload(obj))
File "/usr/local/lib/python3.6/site-packages/itsdangerous.py", line 847, in dump_payload
json = super(URLSafeSerializerMixin, self).dump_payload(obj)
File "/usr/local/lib/python3.6/site-packages/itsdangerous.py", line 550, in dump_payload
return want_bytes(self.serializer.dumps(obj))
File "/usr/local/lib/python3.6/site-packages/flask/json/tag.py", line 296, in dumps
return dumps(self.tag(value), separators=(',', ':'))
File "/usr/local/lib/python3.6/site-packages/flask/json/init.py", line 179, in dumps
rv = _json.dumps(obj, **kwargs)
File "/usr/local/lib/python3.6/site-packages/simplejson/init.py", line 399, in dumps
**kw).encode(obj)
File "/usr/local/lib/python3.6/site-packages/simplejson/encoder.py", line 296, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/local/lib/python3.6/site-packages/simplejson/encoder.py", line 378, in iterencode
return _iterencode(o, 0)
File "/usr/local/lib/python3.6/site-packages/flask/json/init.py", line 81, in default
return _json.JSONEncoder.default(self, o)
File "/usr/local/lib/python3.6/site-packages/simplejson/encoder.py", line 273, in default
o.class.name)
TypeError: Object of type MemoryError is not JSON serializable

@kristw kristw added !deprecated-label:bug Deprecated label - Use #bug instead v0.28 labels Jan 8, 2019
@RaghuNakka
Copy link

Had issue with the csv upload.

Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1816, in full_dispatch_request
return self.finalize_request(rv)
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1833, in finalize_request
response = self.process_response(response)
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2114, in process_response
self.session_interface.save_session(self, ctx.session, response)
File "/usr/local/lib/python3.6/site-packages/flask/sessions.py", line 375, in save_session
val = self.get_signing_serializer(app).dumps(dict(session))
File "/usr/local/lib/python3.6/site-packages/itsdangerous.py", line 565, in dumps
payload = want_bytes(self.dump_payload(obj))
File "/usr/local/lib/python3.6/site-packages/itsdangerous.py", line 847, in dump_payload
json = super(URLSafeSerializerMixin, self).dump_payload(obj)
File "/usr/local/lib/python3.6/site-packages/itsdangerous.py", line 550, in dump_payload
return want_bytes(self.serializer.dumps(obj))
File "/usr/local/lib/python3.6/site-packages/flask/json/tag.py", line 296, in dumps
return dumps(self.tag(value), separators=(',', ':'))
File "/usr/local/lib/python3.6/site-packages/flask/json/init.py", line 179, in dumps
rv = _json.dumps(obj, **kwargs)
File "/usr/local/lib/python3.6/site-packages/simplejson/init.py", line 399, in dumps
**kw).encode(obj)
File "/usr/local/lib/python3.6/site-packages/simplejson/encoder.py", line 296, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/local/lib/python3.6/site-packages/simplejson/encoder.py", line 378, in iterencode
return _iterencode(o, 0)
File "/usr/local/lib/python3.6/site-packages/flask/json/init.py", line 81, in default
return _json.JSONEncoder.default(self, o)
File "/usr/local/lib/python3.6/site-packages/simplejson/encoder.py", line 273, in default
o.class.name)
TypeError: Object of type UnicodeDecodeError is not JSON serializable

@ohoroyoi
Copy link

ohoroyoi commented Feb 21, 2019

same UnicodeDecodeError here @RaghuNakka

@Guomorpheus
Copy link

Same issue here.

@wmy1997
Copy link

wmy1997 commented Mar 7, 2019

Has anyone solved it yet? Can you tell me how to do?

@ohoroyoi
Copy link

ohoroyoi commented Mar 9, 2019

I solved it. and I don't know that the situation is same, but I re-ran docker build. It worked. @wmy1997 Just remove existing docker build, and re-build

@shaguntyagi
Copy link
Author

It might be because of the high-size of the file.

@chrissalter
Copy link

chrissalter commented Apr 11, 2019

Hi all,

Fresh install and just ran into this error. To reference @shaguntyagi 's "It might be because of the high-size of the file.", the file size is 31.6MB

        Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1615, in full_dispatch_request
    return self.finalize_request(rv)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1632, in finalize_request
    response = self.process_response(response)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1858, in process_response
    self.save_session(ctx.session, response)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 924, in save_session
    return self.session_interface.save_session(self, session, response)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/sessions.py", line 363, in save_session
    val = self.get_signing_serializer(app).dumps(dict(session))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/itsdangerous/serializer.py", line 166, in dumps
    payload = want_bytes(self.dump_payload(obj))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/itsdangerous/url_safe.py", line 42, in dump_payload
    json = super(URLSafeSerializerMixin, self).dump_payload(obj)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/itsdangerous/serializer.py", line 133, in dump_payload
    return want_bytes(self.serializer.dumps(obj, **self.serializer_kwargs))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/sessions.py", line 85, in dumps
    return json.dumps(_tag(value), separators=(',', ':'))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/json.py", line 167, in dumps
    rv = _json.dumps(obj, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/simplejson/__init__.py", line 399, in dumps
    **kw).encode(obj)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/simplejson/encoder.py", line 296, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/simplejson/encoder.py", line 378, in iterencode
    return _iterencode(o, 0)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/json.py", line 81, in default
    return _json.JSONEncoder.default(self, o)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/simplejson/encoder.py", line 273, in default
    o.__class__.__name__)
TypeError: Object of type UnicodeDecodeError is not JSON serializable


@wmy1997
Copy link

wmy1997 commented Apr 12, 2019

Hi all,

Fresh install and just ran into this error. To reference @shaguntyagi 's "It might be because of the high-size of the file.", the file size is 31.6MB

        Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1615, in full_dispatch_request
    return self.finalize_request(rv)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1632, in finalize_request
    response = self.process_response(response)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1858, in process_response
    self.save_session(ctx.session, response)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 924, in save_session
    return self.session_interface.save_session(self, session, response)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/sessions.py", line 363, in save_session
    val = self.get_signing_serializer(app).dumps(dict(session))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/itsdangerous/serializer.py", line 166, in dumps
    payload = want_bytes(self.dump_payload(obj))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/itsdangerous/url_safe.py", line 42, in dump_payload
    json = super(URLSafeSerializerMixin, self).dump_payload(obj)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/itsdangerous/serializer.py", line 133, in dump_payload
    return want_bytes(self.serializer.dumps(obj, **self.serializer_kwargs))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/sessions.py", line 85, in dumps
    return json.dumps(_tag(value), separators=(',', ':'))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/json.py", line 167, in dumps
    rv = _json.dumps(obj, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/simplejson/__init__.py", line 399, in dumps
    **kw).encode(obj)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/simplejson/encoder.py", line 296, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/simplejson/encoder.py", line 378, in iterencode
    return _iterencode(o, 0)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/json.py", line 81, in default
    return _json.JSONEncoder.default(self, o)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/simplejson/encoder.py", line 273, in default
    o.__class__.__name__)
TypeError: Object of type UnicodeDecodeError is not JSON serializable

I solved it. and I don't know that the situation is same, but I re-ran docker build. It worked. @wmy1997 Just remove existing docker build, and re-build

22/5000
Maybe because I used anaconda's way to build it

@HuangJT
Copy link

HuangJT commented Jun 21, 2019

Had issue with the csv upload when the csv file has Chinese characters.It is fine when I replace Chinese characters with English.

How to solve?

Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1816, in full_dispatch_request
return self.finalize_request(rv)
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1833, in finalize_request
response = self.process_response(response)
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2114, in process_response
self.session_interface.save_session(self, ctx.session, response)
File "/usr/local/lib/python3.6/site-packages/flask/sessions.py", line 375, in save_session
val = self.get_signing_serializer(app).dumps(dict(session))
File "/usr/local/lib/python3.6/site-packages/itsdangerous.py", line 565, in dumps
payload = want_bytes(self.dump_payload(obj))
File "/usr/local/lib/python3.6/site-packages/itsdangerous.py", line 847, in dump_payload
json = super(URLSafeSerializerMixin, self).dump_payload(obj)
File "/usr/local/lib/python3.6/site-packages/itsdangerous.py", line 550, in dump_payload
return want_bytes(self.serializer.dumps(obj))
File "/usr/local/lib/python3.6/site-packages/flask/json/tag.py", line 296, in dumps
return dumps(self.tag(value), separators=(',', ':'))
File "/usr/local/lib/python3.6/site-packages/flask/json/init.py", line 179, in dumps
rv = _json.dumps(obj, **kwargs)
File "/usr/local/lib/python3.6/site-packages/simplejson/init.py", line 399, in dumps
**kw).encode(obj)
File "/usr/local/lib/python3.6/site-packages/simplejson/encoder.py", line 296, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/local/lib/python3.6/site-packages/simplejson/encoder.py", line 378, in iterencode
return _iterencode(o, 0)
File "/usr/local/lib/python3.6/site-packages/flask/json/init.py", line 81, in default
return _json.JSONEncoder.default(self, o)
File "/usr/local/lib/python3.6/site-packages/simplejson/encoder.py", line 273, in default
o.class.name)
TypeError: Object of type UnicodeEncodeError is not JSON serializable

@devcode2
Copy link

I have the same problem.
superset --version
Flask 0.12.4
Python 3.6.8 (default, Apr 25 2019, 21:02:35)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]

@bbhuston
Copy link

Bump. I am hitting this as well. Hoping someone has insight into what the culprit is

@villebro
Copy link
Member

Can you provide a short example snippet/csv file that makes it possible to replicate the problem? Would make it much easier to debug.

@HuangJT
Copy link

HuangJT commented Sep 29, 2019

Can you provide a short example snippet/csv file that makes it possible to replicate the problem? Would make it much easier to debug.

like this.
superset_upload_error.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
!deprecated-label:bug Deprecated label - Use #bug instead v0.28
Projects
None yet
Development

No branches or pull requests