-
Notifications
You must be signed in to change notification settings - Fork 210
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: decode() argument 1 must be string, not None #14
Comments
I got this error, too. I solved by setting encoding to UTF-8. pyrax.encoding = "utf-8" According to the documentation, the encoding is supposed to be UTF-8 by default. I think this is a bug. |
There is an error in line 25 of your script:
You are using the method signature for That doesn't explain the encoding issue, though. Make sure that you don't have an
That should print 'utf-8', which is the default. |
No pyrax.cfg in use. Updated the code: https://github.com/Linuturk/www.onitato.com/blob/master/cf_pyrax.py Updated Output:
|
@EdLeafe I, too, have experienced this error without using a configuration file at all: >>> import pyrax
>>> pyrax.set_credentials('dustinfarris', 'xxxapikeyxxx')
>>> connection = pyrax.connect_to_couldfiles(region="ORD")
>>> container = connection.get_container("dustinfarris")
>>> connection.sync_folder_to_container("/Users/dustin/Documents/", container)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/dustin/.virtualenvs/dustinfarris/lib/python2.7/site-packages/pyrax/cf_wrapper/client.py", line 516, in sync_folder_to_container
include_hidden=include_hidden, ignore_timestamps=ignore_timestamps)
File "/Users/dustin/.virtualenvs/dustinfarris/lib/python2.7/site-packages/pyrax/cf_wrapper/client.py", line 542, in _sync_folder_to_container
obj = cont.get_object(fullname)
File "/Users/dustin/.virtualenvs/dustinfarris/lib/python2.7/site-packages/pyrax/cf_wrapper/container.py", line 85, in get_object
name = name.decode(pyrax.encoding)
TypeError: decode() argument 1 must be string, not None
>>> As I mentioned above, explicitly setting pyrax.encoding to "utf-8" resolves the error. |
@EdLeafe Unless _read_config_settings is actually called, encoding is set to None. You never actually set this variable anywhere else than in the mentioned function. |
Ah, I see it now - thanks. I will have this fixed soon, and will include the fix to issue #10, too. |
Please test with the current 'working' branch and let me know if you still see any issues. |
The new sync_folder_to_container looks awesome, but I'm getting a type error when I attempt to call it.
My script: https://github.com/Linuturk/www.onitato.com/blob/master/cf_pyrax.py
Output after the various credentials are supplied at the top of the file.
The text was updated successfully, but these errors were encountered: