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

TypeError: can only concatenate str (not "bytes") to str #74

Closed
ashokrai opened this issue Feb 26, 2019 · 4 comments
Closed

TypeError: can only concatenate str (not "bytes") to str #74

ashokrai opened this issue Feb 26, 2019 · 4 comments

Comments

@ashokrai
Copy link

ashokrai commented Feb 26, 2019

In windows 10, when I run the command
D:\safaribooks>python safaribooks.py --cred "myemail:mypassword" bookisbn
the following error occurs;

Error in sys.excepthook:
Traceback (most recent call last):
File "safaribooks.py", line 98, in unhandled_exception
self.exit("Unhandled Exception: %s (type: %s)" % (o, o.class.name))
File "safaribooks.py", line 84, in exit
self.error(str(error))
File "safaribooks.py", line 81, in error
self.out(output)
File "safaribooks.py", line 67, in out
sys.stdout.write("\r" + " " * self.columns + "\r" + put.encode("utf-8", "replace") + "\n")
TypeError: can only concatenate str (not "bytes") to str

Original exception was:
Traceback (most recent call last):
File "safaribooks.py", line 1026, in
SafariBooks(args_parsed)
File "safaribooks.py", line 274, in init
self.display.intro()
File "safaribooks.py", line 117, in intro
self.out(output)
File "safaribooks.py", line 67, in out
sys.stdout.write("\r" + " " * self.columns + "\r" + put.encode("utf-8", "replace") + "\n")
TypeError: can only concatenate str (not "bytes") to str

@fgsummer
Copy link

fgsummer commented Feb 26, 2019

Because of 401:
[#] API: Out-of-Session (Authentication credentials were not provided.).

cookies:{'BrowserCookie': '1481717c-9e93-4ef8-...1ea54b723', 'csrfsafari': 'wqOUcWBE9xxhFPqHR1F...7m8Fba3CM', 'sessionid': '0cddpq1y7dbesga....pyw8s57m7'}
'BrowserCookie' (4406206320):'1481717c-9e93-4ef8-b491-9e31ea54b723'
'csrfsafari' (4406206000):'wqOUcWBE9xxhFPqHR1FJR......E7G8hHAS0f3VNuEdoYF32V7m8Fba3CM'
'sessionid' (4406205616):'0cddpq1y7dbesga8vk....yw8s57m7'
len:3

Works with cookie.json see Issue #2

lorenzodifuccia added a commit that referenced this issue Mar 3, 2019
@lorenzodifuccia
Copy link
Owner

e4c8c55 should fix this issue.

@lorenzodifuccia
Copy link
Owner

Pull last commit: b96819b

@ashokrai
Copy link
Author

ashokrai commented Mar 6, 2019

Thank you, indeed, this solved the problem.

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

No branches or pull requests

3 participants