packt-cli / Packt-Publishing-Free-Learning

Scripts that automatically claim and download free daily eBooks from https://www.packtpub.com/packt/offers/free-learning

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

problem with special characters?

wotd opened this issue · comments

during packtFreeBookDownloader.py execution:

Traceback (most recent call last):
File "packtFreeBookDownloader.py", line 187, in
downloader.downloadBooks(downloader.downloadBookTitles, downloader.downloadFormats)
File "packtFreeBookDownloader.py", line 156, in downloadBooks
if(os.path.isfile(fullFilePath)):
File "/usr/lib/python2.7/genericpath.py", line 37, in isfile
st = os.stat(path)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2013' in position 31: ordinal not in range(128)

Check the newest more clean and compressed version of the script. Should your problem be fixed

Sorry, stil same problem. It looks like there is a problem with ebooks with dash in title?

weird, i have dwnloaded all the titles from the account and worked correctly, Can you give me the exact title you come across a problem with ?

This error occurs before script display title. But \u2013 is dash I think, so I suspect this book:
"Kali Linux – Assuring Security by Penetration Testing [eBook] "

tested both on windows7 and ubuntu with Python ver 2.7 and 3.5 and seems to work without any with this title. Please check the latest version once again and let me know

Had the same issue with that very book that wotd reported.... My code change at the link below resolves the issue:
trancen@894927b