Skip to content

Commit

Permalink
Per Github issue pycontribs/pyrax#14, manually set encoding as it is …
Browse files Browse the repository at this point in the history
…returning None after importing pyrax.
  • Loading branch information
Linuturk committed Feb 12, 2013
1 parent 06f0a10 commit 5dd41e1
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions cf_pyrax.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/python
import pyrax, time
print "Encoding:", pyrax.encoding
pyrax.encoding = "utf-8"

# Set variables for the various options
username = ""
Expand All @@ -21,22 +23,6 @@
cont = cf_ord.get_container(container)

# Upload the entire folder to the cloud files container.
print "Uploading all objects to %s container from folder %s." % (container, folder)
upload_key, total_bytes = cf_ord.sync_folder_to_container(folder, container, delete=True, include_hidden=True, ignore_timestamps=True)

count = 0
timeout_error = 0

while total_bytes != pyrax.cloudfiles.get_uploaded(upload_key):
uploaded_bytes = pyrax.cloudfiles.get_uploaded(upload_key)
print "Still uploading %i out of %i" % (uploaded_bytes, total_bytes)
time.sleep(1)
count += 1
if count > 60:
timeout_error = 1
break
else:
if timeout_error == 0:
print "Upload of %i bytes complete." % total_bytes
else:
print "Upload progress timed out. You might want to re-run the upload."
print "Syncing all objects to %s container from folder %s." % (container, folder)
cf_ord.sync_folder_to_container(folder, container, delete=True, include_hidden=True, ignore_timestamps=True)
print "Sync complete."

0 comments on commit 5dd41e1

Please sign in to comment.