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

Unhandled exception when creating csv reader #11

Closed
Almenon opened this issue Aug 15, 2017 · 0 comments
Closed

Unhandled exception when creating csv reader #11

Almenon opened this issue Aug 15, 2017 · 0 comments
Assignees
Labels

Comments

@Almenon
Copy link
Owner

Almenon commented Aug 15, 2017

import csv

with open('stocks.csv') as f:
  x = csv.reader(f)

Traceback (most recent call last):\n File "C:\dev\AREPL\src\python\pythonEvaluator.py", line 53, in exec_input\n returnInfo['userVariables'] = jsonpickle.encode(userVariables)\n File "C:\dev\AREPL\src\python\jsonpickle_init_.py", line 135, in encode\n numeric_keys=numeric_keys)\n File "C:\dev\AREPL\src\python\jsonpickle\pickler.py", line 44, in encode\n return backend.encode(context.flatten(value, reset=reset))\n File "C:\dev\AREPL\src\python\jsonpickle\pickler.py", line 157, in flatten\n return self._flatten(obj)\n File "C:\dev\AREPL\src\python\jsonpickle\pickler.py", line 161, in _flatten\n return self._pop(self._flatten_obj(obj))\n File "C:\dev\AREPL\src\python\jsonpickle\pickler.py", line 177, in _flatten_obj\n return flatten_func(obj)\n File "C:\dev\AREPL\src\python\jsonpickle\pickler.py", line 429, in _flatten_dict_obj\n flatten(k, v, data)\n File "C:\dev\AREPL\src\python\jsonpickle\pickler.py", line 498, in _flatten_key_value_pair\n data[k] = self._flatten(v)\n File "C:\dev\AREPL\src\python\jsonpickle\pickler.py", line 161, in _flatten\n return self._pop(self._flatten_obj(obj))\n File "C:\dev\AREPL\src\python\jsonpickle\pickler.py", line 177, in _flatten_obj\n return flatten_func(obj)\n File "C:\dev\AREPL\src\python\jsonpickle\pickler.py", line 235, in _ref_obj_instance\n return self._flatten_obj_instance(obj)\n File "C:\dev\AREPL\src\python\jsonpickle\pickler.py", line 367, in _flatten_obj_instance\n data[tags.ITERATOR] = list(map(self._flatten, islice(obj, self._max_iter)))\nValueError: I/O operation on closed file.\n

It looks like JSONpickle is failing to encode x. The JSONpickle API mentions that it can't encode file descriptors so this might be related to that. Still, I would've expected x to be encoded as None rather than an unhandled exception.

@Almenon Almenon changed the title Unhandled exception when creating reader Unhandled exception when creating csv reader Aug 15, 2017
@Almenon Almenon self-assigned this Aug 15, 2017
@Almenon Almenon added the bug label Aug 15, 2017
@Almenon Almenon added this to the v1.0.0-alpha.2 milestone Aug 15, 2017
@Almenon Almenon closed this as completed Aug 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant