Home  >  Q&A  >  body text

Qiniu Cloud Storage - Qiniu Python version SDK cannot upload images due to version issues

environment

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?

怪我咯怪我咯2711 days ago642

reply all(2)I'll reply

  • 为情所困

    为情所困2017-05-18 11:03:10

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

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-05-18 11:03:10

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

    reply
    0
  • Cancelreply