Re: [pylons-discuss] Issues migrating dynamic CSV to Python3

2020-10-19 Thread Bert JW Regeer
That is because response.body_file is https://github.com/Pylons/webob/blob/99890b763dbd441ca1e5f14f8418efa2a8173ab0/src/webob/response.py#L1445 which calls https://github.com/Pylons/webo

Re: [pylons-discuss] Issues migrating dynamic CSV to Python3

2020-10-19 Thread Mike Orr
On Sun, Oct 18, 2020 at 1:22 PM Bert JW Regeer wrote: > > Your body_file is not bytes, but str. You need to make sure that what you > pass to body_file returns bytes. I thought that but 'writer = csv.writer(response.body_file)' works for me, and my row items are 'str'. In Python 2 I had to conve

Re: [pylons-discuss] Issues migrating dynamic CSV to Python3

2020-10-19 Thread Jonathan Vanasco
Thanks, everyone! Now I've got both these debugtoolbar plugins updated PyPi and running on Github Actions with expanded test-suites: * https://github.com/jvanasco/pyramid_debugtoolbar_api_performance * https://github.com/jvanasco/pyramid_debugtoolbar_api_sqlalchemy On Monday, October 19, 2020

Re: [pylons-discuss] Issues migrating dynamic CSV to Python3

2020-10-19 Thread Jonathan Vanasco
Actually, just using `body=csvfile.read()` works on Python2 & Python3 ! On Monday, October 19, 2020 at 11:32:48 AM UTC-4 the...@luhn.com wrote: > Since you’re just dumping the entire file into BytesIO anyways, wouldn’t > it be easier to do `body=csvfile.read().encode(“utf8”)` and skip BytesIO?

Re: [pylons-discuss] Issues migrating dynamic CSV to Python3

2020-10-19 Thread Theron Luhn
Since you’re just dumping the entire file into BytesIO anyways, wouldn’t it be easier to do `body=csvfile.read().encode(“utf8”)` and skip BytesIO? > On Oct 18, 2020, at 3:33 PM, Jonathan Vanasco wrote: > > Thanks so much, Bert. That should have been obvious! > > As an interim solution, I'm jus

Re: [pylons-discuss] Issues migrating dynamic CSV to Python3

2020-10-18 Thread Jonathan Vanasco
Thanks so much, Bert. That should have been obvious! As an interim solution, I'm just wrapping the inputs: if six.PY3: csvfile = BytesIO(csvfile.read().encode("utf-8")) csvfile.seek(0) On Sunday, October 18, 2020 at 4:22:16 PM UTC-4 Bert JW Regeer wrote: > Your body_file i

Re: [pylons-discuss] Issues migrating dynamic CSV to Python3

2020-10-18 Thread Bert JW Regeer
Your body_file is not bytes, but str. You need to make sure that what you pass to body_file returns bytes. > On Oct 16, 2020, at 15:03, Jonathan Vanasco wrote: > > I discovered an issue with our code when generating dynamic CSVs under > Python3. I'm hoping someone can point me in the right di

[pylons-discuss] Issues migrating dynamic CSV to Python3

2020-10-16 Thread Jonathan Vanasco
I discovered an issue with our code when generating dynamic CSVs under Python3. I'm hoping someone can point me in the right direction. I couldn't find the appropriate migration/changelog information. This works fine under Python2. The generic way we create/serve the CSV and check it in test