Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在rackspace中上载整个文件夹而不是逐个文件_Python_Rackspace Cloudfiles - Fatal编程技术网

Python 如何在rackspace中上载整个文件夹而不是逐个文件

Python 如何在rackspace中上载整个文件夹而不是逐个文件,python,rackspace-cloudfiles,Python,Rackspace Cloudfiles,现在我正在使用这样的线程,但速度很慢。我正在寻找什么上传一个文件夹api def run(self): """Starts the uploading thread.""" try: for file_name in self.files["thumbs"]: self.transfer_rackspace(file_name, self.container_thumbs) except Ex

现在我正在使用这样的线程,但速度很慢。我正在寻找什么上传一个文件夹api

def run(self):
        """Starts the uploading thread."""
        try:
            for file_name in self.files["thumbs"]:
                self.transfer_rackspace(file_name, self.container_thumbs)
        except Exception:
            pass
        try:
            for file_name in self.files["tiles"]:
                self.transfer_rackspace(file_name, self.container_tiles)
        except Exception:
            pass
        try:
            for file_name in self.files["cube"]:
                self.transfer_rackspace(file_name, self.container_photo)
        except Exception:
            pass
        try:
            for file_name in self.files["image"]:
                self.transfer_rackspace(file_name, self.container_photo)
        except Exception:
            pass

只是一点小小的评论:你是在用
找麻烦,例外情况除外:pass
。我只是要求安全,否则它永远不会失败。但是速度很慢
pyrax.settings.set('identity_type', 'rackspace')
pyrax.set_credentials(config.app_config["cdn.account.name"],
                          config.app_config["cdn.account.key"])
rack_conn = pyrax.cloudfiles
rack_conn.upload_folder(folder_path, container)