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 Excel files with dates #10

Closed
szeke opened this issue Jul 4, 2019 · 4 comments
Closed

Cannot load Excel files with dates #10

szeke opened this issue Jul 4, 2019 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@szeke
Copy link
Collaborator

szeke commented Jul 4, 2019

Exception:

 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
[2019-07-04 16:10:37,387] ERROR in app: Exception on /upload_excel [POST]
Traceback (most recent call last):
  File "/Users/pedroszekely/.virtualenvs/t2wml/lib/python3.7/site-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/pedroszekely/.virtualenvs/t2wml/lib/python3.7/site-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/pedroszekely/.virtualenvs/t2wml/lib/python3.7/site-packages/flask_cors/extension.py", line 161, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/Users/pedroszekely/.virtualenvs/t2wml/lib/python3.7/site-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/pedroszekely/.virtualenvs/t2wml/lib/python3.7/site-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/Users/pedroszekely/.virtualenvs/t2wml/lib/python3.7/site-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/pedroszekely/.virtualenvs/t2wml/lib/python3.7/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "application.py", line 70, in upload_excel
    return upload_file(user_id, sheet_name)
  File "application.py", line 40, in upload_file
    data = excel_to_json(file_path, sheet_name)
  File "/Users/pedroszekely/Documents/GitHub/t2wml/Code/utility_functions.py", line 100, in excel_to_json
    return json.dumps(result)
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type date is not JSON serializable
@szeke
Copy link
Collaborator Author

szeke commented Jul 4, 2019

This file will not load:
DT.ODA.ODAT.GI.ZS.xls.zip

@szeke szeke added the bug Something isn't working label Jul 4, 2019
@bhatiadivij
Copy link
Collaborator

The bug has already been fixed but the updated code has not been pushed.

@szeke
Copy link
Collaborator Author

szeke commented Jul 5, 2019

When you push the code, close the issue.

@bhatiadivij
Copy link
Collaborator

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants