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

event_results: TypeError: initial_value must be str or None, not bytes #4

Open
LaundroMat opened this issue Mar 7, 2016 · 2 comments · May be fixed by #7
Open

event_results: TypeError: initial_value must be str or None, not bytes #4

LaundroMat opened this issue Mar 7, 2016 · 2 comments · May be fixed by #7

Comments

@LaundroMat
Copy link

After logging in, I try to get event results with

irw.event_results(16206499)

This is the error I get:

TypeError                                 Traceback (most recent call last)
<ipython-input-11-0759defbe2a6> in <module>()
----> 1 irw.event_results(16206499)

<decorator-gen-139> in event_results(self, subsession, sessnum)

C:\Users\Mathieu\Development\iracing-test\ir_webstats\util.py in __logged_in(func, *args, **kw)
     35         args2[1] = args2[1] if args2[1] is not None else irweb.custid
     36 
---> 37     return func(*args2, **kw)
     38 
     39 

C:\Users\Mathieu\Development\iracing-test\ir_webstats\client.py in event_results(self, subsession, sessnum)
    462         r = self.__req(ct.URL_GET_EVENTRESULTS % (subsession, sessnum))\
    463                 .encode('utf8')
--> 464         data = [x for x in csv.reader(StringIO(r), delimiter=',',
    465                                       quotechar='"')]
    466         header_ev, header_res = data[0], data[3]

TypeError: initial_value must be str or None, not bytes

Using python 3.5 on Windows 10.

LaundroMat added a commit to LaundroMat/ir_webstats that referenced this issue Mar 7, 2016
Fixes jeysonm82#4

Not tested on python 2.x
@musantro
Copy link

Same issue here, I'm going to test your commit and I will let you know

@lowlyocean
Copy link

lowlyocean commented Jan 6, 2019

If you comment out line 463, i.e. .encode('utf8') then it works as expected. This patch should be merged in.

Actually, prefer the approach r.decode('utf8') when passing to StringIO

lowlyocean added a commit to lowlyocean/ir_webstats that referenced this issue Jan 6, 2019
@lowlyocean lowlyocean linked a pull request Jan 6, 2019 that will close this issue
lowlyocean added a commit to lowlyocean/ir_webstats that referenced this issue May 4, 2020
lowlyocean added a commit to lowlyocean/ir_webstats that referenced this issue May 4, 2020
lowlyocean added a commit to lowlyocean/ir_webstats that referenced this issue May 4, 2020
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

Successfully merging a pull request may close this issue.

3 participants