-
Notifications
You must be signed in to change notification settings - Fork 34
Container with unicode file names #94
Comments
@nmorenor Thanks for reporting this issue. It seems that this is a problem in Python 2.7 and not for python 3.4. I am working on a fix and will hopefully have that up soon. |
The quoter function was not able to deal with a unicode encoded unicode string when running on Python2.7. When something like this was passed it would result in a KeyError. To fix this a "try/Except" was added to the system such that it allows the origial value to be passed back from the method in such a case. This was done because we can safely assume that a unicode encoded unicode string is already in a state that has been quoted for use both remotely and locally. This also fixed a typo as urlparse was miss-spelled. Closes-Bug: #94 Signed-off-by: Kevin Carter <[email protected]>
The quoter function was not able to deal with a unicode encoded unicode string when running on Python2.7. When something like this was passed it would result in a KeyError. To fix this a "try/Except" was added to the system such that it allows the origial value to be passed back from the method in such a case. This was done because we can safely assume that a unicode encoded unicode string is already in a state that has been quoted for use both remotely and locally. Closes-Bug: #94 Signed-off-by: Kevin Carter <[email protected]>
I pushed a change to master which should fix this please let me know if there continues to be an issue of if this is resolved. |
Now it is not throwing the same error however, it is printing: /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py:1294: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal Hopefully this is just a warning, and it will do the right thing. Thanks |
yea the warning is expected however with the previous commit it should pass the original data through the function. That said let me know if its not working as expected. |
Hi, I just get in to this, seems it is concerning this same issue, with the new code from master Process Process-13: |
Seems that this is related to that python brew install of python, I just tried to compile install the python 2.7.9 on that same box, it seems to be working now Cheers |
Mhmm... I just hit the same issue again. UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in position 58: ordinal not in range(128) |
do you know what versions of Python you're running? Also whats the base OS? I've not been able recreate this issue in Python 2.7.10 and 3.4.3 |
I'm running turbolift in a linux debian 6 (squeeze) with python 2.7.9. I had to compile it to get that version of python, I also tried to use the 3.4.3 but it did not allow me to install turbolift. In order to make progress I had to add something like: with open(local_object.encode("utf-8"), 'wb') as f_name: and do the same for all other places that reference to "local_object" in "turbolift/clouderator/actions.py" _getter function. But seems that I now need to set a smaller number of jobs because of a memory error. I guess "utf-8" is expensive |
This is the error I got about memory, note that I've modified some lines at "turbolift/clouderator/actions.py" Processing - [ - ] - Number of Jobs in Queue = 68 Processing workload... /usr/local/lib/python2.7/urllib.py:1294: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal |
The memory thing was a local configuration thing, however I did had to make that change to encode on uff-8 and that just work: "open(local_object.encode("utf-8"), 'wb') as f_name:" It just worked for me. Thanks |
Hi,
Hi I'm trying to download a container that contains files with unicode characters in the name and I'm getting these errors.
Using a command like:
turbolift -u ${user} -a ${api_key} --os-rax-auth ord download -c ${container name}
File "/usr/local/lib/python2.7/urllib.py", line 1294, in quote
return ''.join(map(quoter, s))
KeyError: u'\u0301'
Processing - [ / ] - Number of Jobs in Queue = 0 Processing workload... Done.
Processing - [ \ ] - Number of Jobs in Queue = 0 Processing workload... Done.
Processing - [ / ] - Number of Jobs in Queue = 8 Processing workload... Process Process-241864:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
Processing - [ - ] - Number of Jobs in Queue = 8 Processing workload... self.run()
File "/usr/local/lib/python2.7/multiprocessing/process.py", line 114, in run
self._target(_self._args, *_self._kwargs)
File "build/bdist.linux-x86_64/egg/turbolift/methods/init.py", line 323, in _process_func
func(**queue.get(timeout=.5))
File "build/bdist.linux-x86_64/egg/turbolift/methods/init.py", line 136, in _get
local_object=local_object
File "build/bdist.linux-x86_64/egg/turbolift/clouderator/utils.py", line 41, in f_retry
return f(_args, *_kwargs)
File "build/bdist.linux-x86_64/egg/turbolift/clouderator/actions.py", line 618, in get_items
container_object=container_object
File "build/bdist.linux-x86_64/egg/turbolift/clouderator/actions.py", line 69, in _return_base_data
_container_uri, cloud_utils.quoter(container_object)
File "build/bdist.linux-x86_64/egg/turbolift/clouderator/utils.py", line 144, in quoter
return urllib.quote(obj)
File "/usr/local/lib/python2.7/urllib.py", line 1294, in quote
return ''.join(map(quoter, s))
KeyError: u'\u0301'
Awesome client, keep up the work :)
The text was updated successfully, but these errors were encountered: