<tfoot id='zMfNd'></tfoot>

  • <legend id='zMfNd'><style id='zMfNd'><dir id='zMfNd'><q id='zMfNd'></q></dir></style></legend>
    <i id='zMfNd'><tr id='zMfNd'><dt id='zMfNd'><q id='zMfNd'><span id='zMfNd'><b id='zMfNd'><form id='zMfNd'><ins id='zMfNd'></ins><ul id='zMfNd'></ul><sub id='zMfNd'></sub></form><legend id='zMfNd'></legend><bdo id='zMfNd'><pre id='zMfNd'><center id='zMfNd'></center></pre></bdo></b><th id='zMfNd'></th></span></q></dt></tr></i><div id='zMfNd'><tfoot id='zMfNd'></tfoot><dl id='zMfNd'><fieldset id='zMfNd'></fieldset></dl></div>
  • <small id='zMfNd'></small><noframes id='zMfNd'>

        • <bdo id='zMfNd'></bdo><ul id='zMfNd'></ul>
      1. 无错误:无法在谷歌云存储上看到上传的文件

        No Error: Not able to see the uploaded file on the google cloud storage(无错误:无法在谷歌云存储上看到上传的文件)
        <legend id='llF7V'><style id='llF7V'><dir id='llF7V'><q id='llF7V'></q></dir></style></legend>

          <tfoot id='llF7V'></tfoot>

          <small id='llF7V'></small><noframes id='llF7V'>

              <bdo id='llF7V'></bdo><ul id='llF7V'></ul>

              1. <i id='llF7V'><tr id='llF7V'><dt id='llF7V'><q id='llF7V'><span id='llF7V'><b id='llF7V'><form id='llF7V'><ins id='llF7V'></ins><ul id='llF7V'></ul><sub id='llF7V'></sub></form><legend id='llF7V'></legend><bdo id='llF7V'><pre id='llF7V'><center id='llF7V'></center></pre></bdo></b><th id='llF7V'></th></span></q></dt></tr></i><div id='llF7V'><tfoot id='llF7V'></tfoot><dl id='llF7V'><fieldset id='llF7V'></fieldset></dl></div>
                  <tbody id='llF7V'></tbody>
                  本文介绍了无错误:无法在谷歌云存储上看到上传的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  使用 云函数 python 在云函数上运行 python 代码.p>

                  我正在处理云上的图像.现在我想将该图像保存在 google-cloud-storage

                  从 google.cloud 导入存储导入简历2从临时文件导入 NamedTemporaryFile导入操作系统客户端 = 存储.客户端()bucket = client.get_bucket('document')图像 = cv2.imread('15.png')使用 NamedTemporaryFile() 作为临时:打印(类型(temp.name),",temp.name)iName = "".join([str(temp.name),".jpg"])打印(iName)cv2.imwrite(iName,image)打印(os.path.exists(str(iName)))blob = bucket.blob('document/Test15.jpg')blob.upload_from_filename(iName)

                  我的输出

                  <块引用>

                  <类'str'>

                  /var/folders/5j/bqk11bqj4r55f8975mn__72m0000gq/T/tmplcgzaucx

                  /var/folders/5j/bqk11bqj4r55f8975mn__72m0000gq/T/tmplcgzaucx.jpg

                  是的

                  不知道怎么回事

                  谁能提出解决方案?

                  解决方案

                  愚蠢的错误,结果

                  blob = bucket.blob('document/Test15.jpg')

                  在桶 document

                  内创建另一个文件夹 document

                  所以实际路径是 document/document/Test15.jpg

                  Have a python code running on cloud function using cloud function python.

                  I'm processing an image on cloud. Now I want to save that image on google-cloud-storage

                  from google.cloud import storage
                  import cv2
                  from tempfile import NamedTemporaryFile
                  import os
                  
                  client = storage.Client()
                  
                  bucket = client.get_bucket('document')
                  
                  image = cv2.imread('15.png')
                  
                  with NamedTemporaryFile() as temp:
                      print(type(temp.name)," ",temp.name)
                      iName = "".join([str(temp.name),".jpg"])
                      print(iName)
                      cv2.imwrite(iName,image)
                      print(os.path.exists(str(iName)))
                      blob = bucket.blob('document/Test15.jpg')
                      blob.upload_from_filename(iName)
                  

                  My output

                  < class 'str' >

                  /var/folders/5j/bqk11bqj4r55f8975mn__72m0000gq/T/tmplcgzaucx

                  /var/folders/5j/bqk11bqj4r55f8975mn__72m0000gq/T/tmplcgzaucx.jpg

                  True

                  Don't know what's going wrong

                  can anyone suggest a solution?

                  解决方案

                  Silly mistake, turns out

                  blob = bucket.blob('document/Test15.jpg')

                  creates another folder document inside the bucket document

                  so the actual path would be document/document/Test15.jpg

                  这篇关于无错误:无法在谷歌云存储上看到上传的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What happens when you compare 2 pandas Series(当你比较 2 个 pandas 系列时会发生什么)
                  Quickly find differences between two large text files(快速查找两个大文本文件之间的差异)
                  Python - Compare 2 files and output differences(Python - 比较 2 个文件和输出差异)
                  Why do comparisions between very large float values fail in python?(为什么在 python 中非常大的浮点值之间的比较会失败?)
                  Dictionary merge by updating but not overwriting if value exists(字典通过更新合并,但如果值存在则不覆盖)
                  Find entries of one text file in another file in python(在python中的另一个文件中查找一个文本文件的条目)

                    <legend id='ZWKMo'><style id='ZWKMo'><dir id='ZWKMo'><q id='ZWKMo'></q></dir></style></legend>

                      <tbody id='ZWKMo'></tbody>

                      <small id='ZWKMo'></small><noframes id='ZWKMo'>

                        <i id='ZWKMo'><tr id='ZWKMo'><dt id='ZWKMo'><q id='ZWKMo'><span id='ZWKMo'><b id='ZWKMo'><form id='ZWKMo'><ins id='ZWKMo'></ins><ul id='ZWKMo'></ul><sub id='ZWKMo'></sub></form><legend id='ZWKMo'></legend><bdo id='ZWKMo'><pre id='ZWKMo'><center id='ZWKMo'></center></pre></bdo></b><th id='ZWKMo'></th></span></q></dt></tr></i><div id='ZWKMo'><tfoot id='ZWKMo'></tfoot><dl id='ZWKMo'><fieldset id='ZWKMo'></fieldset></dl></div>
                          <tfoot id='ZWKMo'></tfoot>
                            <bdo id='ZWKMo'></bdo><ul id='ZWKMo'></ul>