从IBM Cloud Object Storage加载(Geo)JSON

问题描述 投票:0回答:1

如何将我的云对象存储中的JSON文件作为字符串文件而不是作为流主体加载到Jupyter笔记本中。

以下代码为我提供了一个流对象:

jsonfile = client_cred.get_object(Bucket='bucket_name',Key='file.json')['Body']
if not hasattr(jsonfile, "__iter__"): jsonfile.__iter__ = types.MethodType( __iter__, jsonfile)

这不返回任何内容('NoneType'):

nyc_geo = client_cred.download_file(Bucket='bucket_name',Key='file.json',Filename='file.json') 

这可能真的很基础。有人可以帮忙吗?

json ibm-watson ibm-cloud-storage
1个回答
0
投票

@@ Basti,我最近已经为此工作。我有一个类似的问题。我可以从此post中找到答案,而且,请参阅对此IBM sample code的引用。

© www.soinside.com 2019 - 2024. All rights reserved.