Open GoogleCodeExporter opened 8 years ago
Ugh, why does amazon use non-ascii characters in the urls???!!!!????
Original comment by SCColbert@gmail.com
on 15 Apr 2011 at 9:29
I attach a trivial diff which fixes the problem. The url needs to be encoded
as a utf-8 string before the request is issued.
Original comment by jsmull...@gmail.com
on 15 Apr 2011 at 9:29
Attachments:
Thanks! The patch in comment 2 worked. I manually edited the downloader.py file
myself and now files with unicode characters download just fine!
Original comment by yzhern...@gmail.com
on 29 Nov 2011 at 6:16
The patch in comment 2 fixed an undownloadable tune for me too. Looks like
either a plain bug in python 2.7.2, or a clash between the design of Python 2
Unicode handling with respect to urls, and Amazon's url-encoding practices, I
have no idea which.
Original comment by catmat...@gmail.com
on 27 Mar 2012 at 3:37
It's not just amazon's URLs. There's another similar problem when you try and
download a track whose name has non-ascii characters in its name, and pymazon
tries to present you with a list for confirmation:
Traceback (most recent call last):
File "/usr/bin/pymazon", line 67, in <module>
main()
File "/usr/bin/pymazon", line 37, in main
main(amzs)
File "/usr/lib/python2.7/site-packages/pymazon/cmd/ui.py", line 134, in main
runner.run()
File "/usr/lib/python2.7/site-packages/pymazon/cmd/ui.py", line 65, in run
print line.encode('ascii')
UnicodeEncodeError: 'ascii' codec can't encode character u'\xdf' in position
25: ordinal not in range(128)
Then, later, when it tries to save the files:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/site-packages/pymazon/core/downloader.py", line 54, in run
self.do_work()
File "/usr/lib/python2.7/site-packages/pymazon/core/downloader.py", line 68, in do_work
obj.save(data)
File "/usr/lib/python2.7/site-packages/pymazon/core/item_model.py", line 133, in save
super(Track, self).save(save_path, data)
File "/usr/lib/python2.7/site-packages/pymazon/core/item_model.py", line 77, in save
fname = self._safe_save_name(fname)
File "/usr/lib/python2.7/site-packages/pymazon/core/item_model.py", line 70, in _safe_save_name
if not os.path.isfile(nfname):
File "/usr/lib/python2.7/genericpath.py", line 29, in isfile
st = os.stat(path)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position
17: ordinal not in range(128)
Similar tiny patches to the one mentioned above fix the problems at those lines
too.
Original comment by joel.gl...@gmail.com
on 18 May 2012 at 10:21
Original issue reported on code.google.com by
jsmull...@gmail.com
on 15 Apr 2011 at 8:57