packt-cli / Packt-Publishing-Free-Learning

Scripts that automatically claim and download free daily eBooks from https://www.packtpub.com/packt/offers/free-learning
MIT License
857 stars 185 forks source link

problem with special characters? #4

Closed wotd closed 8 years ago

wotd commented 8 years ago

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)

luk6xff commented 8 years ago

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

wotd commented 8 years ago

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

luk6xff commented 8 years ago

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 ?

wotd commented 8 years ago

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] "

luk6xff commented 8 years ago

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

trancen commented 7 years ago

Had the same issue with that very book that wotd reported.... My code change at the link below resolves the issue: https://github.com/trancen/Packt-Publishing-Free-Learning/commit/894927b4d33687e76524eb9c4d9ae13c27fb0bb0