Qiniu Cloud Storage - Qiniu Python version SDK cannot upload images due to version issues
怪我咯
怪我咯 2017-05-18 11:01:10
0
2
646

environment

  • Win7 64-bit

  • Python 3.5.3

question

I discovered this when using UEditor combined with Qiniu SDK to upload pictures

Traceback (most recent call last):
 ...
  File "D:\Python\python34\lib\site-packages\qiniu\zone.py", line 124, in host_cache_file_path
    return home + "/.qiniu_pythonsdk_hostscache.json"
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

The reason is that the system environment variable is not set to HOME

 def host_cache_file_path(self):
        home = os.getenv("HOME")
        return home + "/.qiniu_pythonsdk_hostscache.json"

I would like to ask if this is a BUG of Qiniu, or is it not compatible enough with Python 3.x?

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(2)
为情所困

The problem is with your code. The result of os.getenv("HOME") is still None, and the environment variable is still not passed!

phpcn_u1582

I took a look on GitHub, and the official code has been updated.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!