小编use*_*031的帖子

如何使用 Python API 在 Google Cloud Storage 上上传文件夹

我已成功上传单个文本文件Google Cloud Storage。但是当我尝试上传时whole folder,它允许denied error.

filename = "d:/foldername"   #here test1 is the folder.


Error:
Traceback (most recent call last):
  File "test1.py", line 142, in <module>
    upload()
  File "test1.py", line 106, in upload
    media = MediaFileUpload(filename, chunksize=CHUNKSIZE, resumable=True)
  File "D:\jatin\Project\GAE_django\GCS_test\oauth2client\util.py", line 132, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "D:\jatin\Project\GAE_django\GCS_test\apiclient\http.py", line 422, in __init__
    fd = open(self._filename, 'rb')
IOError: [Errno 13] Permission denied: 'd:/foldername'
Run Code Online (Sandbox Code Playgroud)

python django google-app-engine

9
推荐指数
3
解决办法
6830
查看次数

如何使用python更新zip文件中的一个文件

我有这个zip文件结构.

zipfile name = filename.zip

filename>    images>
             style.css
             default.js
             index.html
Run Code Online (Sandbox Code Playgroud)

我想只更新index.html.我试图更新index.html,但它只包含1.zip文件中的index.html文件,其他文件被重新驱动.

这是我试过的代码:

import zipfile

msg = 'This data did not exist in a file before being added to the ZIP file'
zf = zipfile.ZipFile('1.zip', 
                     mode='w',
                     )
try:
    zf.writestr('index.html', msg)
finally:
    zf.close()

print zf.read('index.html')
Run Code Online (Sandbox Code Playgroud)

那么如何才能使用Python更新index.html文件呢?

python zipfile

9
推荐指数
2
解决办法
2万
查看次数

NotImplementedError:必须安装gflags库才能使用tools.run().请安装gflags或者最好切换到使用tools.run_flow()

我正在开发GAE django非rel应用程序.我正面临着与gflags相关的错误.

NotImplementedError:必须安装gflags库才能使用tools.run().请安装gflags或者最好切换到使用tools.run_flow()

为了解决这个错误,我下载了glags.py和gflags_validators.py并将它们放入我项目的根文件夹中.

通过以上解决方案我得到了另一个错

EOFError at /pages
EOF when reading a line

Exception Value:
EOF when reading a line
Exception Location: D:\jatin\Project\GAE_django\non-rel_django1.5\oauth2client\old_run.py in run,  line 149
Run Code Online (Sandbox Code Playgroud)

python django google-app-engine

5
推荐指数
1
解决办法
2030
查看次数

标签 统计

python ×3

django ×2

google-app-engine ×2

zipfile ×1