azure .common.AzureException: объект 'NoneType' не имеет атрибута 'findall' - PullRequest
0 голосов
/ 13 апреля 2020

Я пытаюсь развернуть приложение Flask на Ubuntu VPS, и я хочу иметь возможность загружать файлы, шифровать их на сервере, а затем хранить их в azure хранилище больших двоичных объектов, но всякий раз, когда я пытаюсь загрузить полученные файлы

azure .common.AzureException: объект 'NoneType' не имеет атрибута 'findall' из /var/log/apache2/error.log

Я не уверен, что такое findall или что означает эта ошибка. Я пытался найти ее в Интернете, но не нашел, вот код, который я использовал для загрузки файлов

  try:
    if session.get('encryptionCode')  is None or not session.get('logged_in'):
        return render_template('index.html')


    block_blob_service = BlockBlobService(account_name=[account_name], account_key=[account_key])
    generator = block_blob_service.list_blobs(POST_USERNAME)
    print(POST_USERNAME,"name")
    f=request.files['file']

    if request.method == 'POST':
      if f.filename == '':
        flash('No selected file')
        return redirect(url_for('indexFiles'))
      # call method encrypt to ecnrypt file
      outputFile=flZK.encrypt(key,f)

      full_path_to_file=os.path.abspath(outputFile)

    # upload to the cloud
      block_blob_service.create_blob_from_path(POST_USERNAME, outputFile, full_path_to_file)
      os.remove(outputFile) #remove the encrypted file locally because it is uploaded to the cloud
  except:
    return redirect(url_for('indexFiles'))

  return redirect(url_for('indexFiles'))

вот откат /var/log/apache2/error.log

[Mon Apr 13 17:56:52.624366 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]  name, referer: http://ip/indexFiles
[Mon Apr 13 17:58:16.803277 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372] ERROR:webApp.run:Exception on /FileUploader [POST], referer: http://ip/indexFiles
[Mon Apr 13 17:58:16.803342 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372] Traceback (most recent call last):, referer: http://ip/indexFiles
[Mon Apr 13 17:58:16.803350 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]   File "/var/www/webApp/webApp/venv3/lib/python3.6/site-packages/azure/storage/storageclient.py", line 244, in _perfo$
[Mon Apr 13 17:58:16.803357 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]     return parser(response), referer: http://ip/indexFiles
[Mon Apr 13 17:58:16.803365 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]   File "/var/www/webApp/webApp/venv3/lib/python3.6/site-packages/azure/storage/blob/_deserialization.py", line 294, i$
[Mon Apr 13 17:58:16.803372 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]     blob_prefix_elements = blobs_element.findall('BlobPrefix'), referer: http://ip/indexFiles
[Mon Apr 13 17:58:16.803378 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372] AttributeError: 'NoneType' object has no attribute 'findall', referer: http://161.35.48.90/indexFiles
[Mon Apr 13 17:58:16.803385 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372] , referer: http://ip/indexFiles
[Mon Apr 13 17:58:16.803391 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372] During handling of the above exception, another exception occurred:, referer: http://ip/indexFiles
[Mon Apr 13 17:58:16.803398 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372] , referer: http://161.35.48.90/indexFiles
[Mon Apr 13 17:58:16.803404 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372] Traceback (most recent call last):, referer: http://ip/indexFiles
[Mon Apr 13 17:58:16.803411 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]   File "/var/www/webApp/webApp/venv3/lib/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app, referer: http$
[Mon Apr 13 17:58:16.803417 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]     response = self.full_dispatch_request(), referer: http://ip/indexFiles
[Mon Apr 13 17:58:16.803424 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]   File "/var/www/webApp/webApp/venv3/lib/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request, $
[Mon Apr 13 17:58:16.803431 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]     rv = self.handle_user_exception(e), referer: http://ip/indexFiles
[Mon Apr 13 17:58:16.803437 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]   File "/var/www/webApp/webApp/venv3/lib/python3.6/site-packages/flask/app.py", line 1821, in handle_user_exception, $
[Mon Apr 13 17:58:16.803444 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]     reraise(exc_type, exc_value, tb), referer: http://ip/indexFiles
[Mon Apr 13 17:58:16.803450 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]   File "/var/www/webApp/webApp/venv3/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise, referer: htt$
[Mon Apr 13 17:58:16.803457 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]     raise value, referer: http:/ip/indexFiles
[Mon Apr 13 17:58:16.803463 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]   File "/var/www/webApp/webApp/venv3/lib/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request, $
[Mon Apr 13 17:58:16.803469 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]     rv = self.dispatch_request(), referer: http://ip/indexFiles
[Mon Apr 13 17:58:16.803491 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]   File "/var/www/webApp/webApp/venv3/lib/python3.6/site-packages/flask/app.py", line 1936, in dispatch_request, refer$
[Mon Apr 13 17:58:16.803498 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]     return self.view_functions[rule.endpoint](**req.view_args), referer: http://ip/indexFiles
[Mon Apr 13 17:58:16.803503 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]   File "/var/www/webApp/webApp/run.py", line 361, in uploadFile, referer: http://ip/indexFiles
[Mon Apr 13 17:58:16.803509 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]     outputFile=flZK.encrypt(key,f), referer: http://ip/indexFiles
[Mon Apr 13 17:58:16.803514 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]   File "/var/www/webApp/webApp/run.py", line 66, in encrypt, referer: http://ip/indexFiles
[Mon Apr 13 17:58:16.803520 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]     generator = block_blob_service.list_blobs(containerName), referer: http://ip/indexFiles
[Mon Apr 13 17:58:16.803525 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]   File "/var/www/webApp/webApp/venv3/lib/python3.6/site-packages/azure/storage/blob/baseblobservice.py", line 1214, i$
[Mon Apr 13 17:58:16.803531 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]     resp = self._list_blobs(*args, **kwargs), referer: http://ip/indexFiles
[Mon Apr 13 17:58:16.803537 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]   File "/var/www/webApp/webApp/venv3/lib/python3.6/site-packages/azure/storage/blob/baseblobservice.py", line 1285, i$
[Mon Apr 13 17:58:16.803543 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]     return self._perform_request(request, _convert_xml_to_blob_list, operation_context=_context), referer: http://161$
[Mon Apr 13 17:58:16.803549 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]   File "/var/www/webApp/webApp/venv3/lib/python3.6/site-packages/azure/storage/storageclient.py", line 280, in _perfo$
[Mon Apr 13 17:58:16.803556 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]     raise ex, referer: http://ip/indexFiles
[Mon Apr 13 17:58:16.803561 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]   File "/var/www/webApp/webApp/venv3/lib/python3.6/site-packages/azure/storage/storageclient.py", line 252, in _perfo$
[Mon Apr 13 17:58:16.803567 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372]     raise AzureException(ex.args[0]), referer: http://ip/indexFiles
[Mon Apr 13 17:58:16.803575 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372] azure.common.AzureException: 'NoneType' object has no attribute 'findall', referer: http://ip/indexFiles
[Mon Apr 13 17:58:16.803586 2020] [wsgi:error] [pid 12938] [client 37.107.188.159:36372] , referer: http://ip/indexFiles

ссылка: https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-python-legacy

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...