Git Product home page Git Product logo

Comments (7)

dustinfarris avatar dustinfarris commented on June 27, 2024

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.

from pyrax.

EdLeafe avatar EdLeafe commented on June 27, 2024

There is an error in line 25 of your script:

 upload_key, total_bytes = cf_ord.sync_folder_to_container(folder, container, delete=True, include_hidden=True, ignore_timestamps=True)

You are using the method signature for cf.upload_folder(); cf.sync_folder_to_container() doesn't run in the background.

That doesn't explain the encoding issue, though. Make sure that you don't have an encoding = entry in your .pyrax.cfg file, and then in your script, add this line right after you import pyrax:

print "Encoding:", pyrax.encoding

That should print 'utf-8', which is the default.

from pyrax.

Linuturk avatar Linuturk commented on June 27, 2024

No pyrax.cfg in use.

Updated the code: https://github.com/Linuturk/www.onitato.com/blob/master/cf_pyrax.py

Updated Output:

Encoding: None
Syncing all objects to www.onitato.com container from folder /var/lib/jenkins/workspace/www.onitato.com/output/.
Sync complete.

from pyrax.

dustinfarris avatar dustinfarris commented on June 27, 2024

@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.

from pyrax.

simonklee avatar simonklee commented on June 27, 2024

@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.

from pyrax.

EdLeafe avatar EdLeafe commented on June 27, 2024

Ah, I see it now - thanks. I will have this fixed soon, and will include the fix to issue #10, too.

from pyrax.

EdLeafe avatar EdLeafe commented on June 27, 2024

Please test with the current 'working' branch and let me know if you still see any issues.

from pyrax.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.