Forums

AttributeError: 'NoneType' object has no attribute 'filename'

when web app (web2py) is loading any ideas how tio solve it?

Can you provide the full stack trace? Does something like this help?

[formatted by admin]

/home/portalwebtrafficjourneys/.local/lib/python3.8/site-packages/google/cloud/bigquery/_pandas_helpers.py:190: UserWarning: Unable to determine type for field 'FullVisitorId
'.
  warnings.warn("Unable to determine type for field '{}'.".format(bq_field.name))
Traceback (most recent call last):
  File "/var/www/portalwebtrafficjourneys_pythonanywhere_com_wsgi.py", line 17, in <module>
    from main import app
  File "/home/portalwebtrafficjourneys/mysite/main.py", line 139, in <module>
    df = pd_gbq.read_gbq(sql_query, project_id=project, dialect='standard', credentials = my_credentials)
  File "/home/portalwebtrafficjourneys/.local/lib/python3.8/site-packages/pandas_gbq/gbq.py", line 972, in read_gbq
    final_df = connector.run_query(
  File "/home/portalwebtrafficjourneys/.local/lib/python3.8/site-packages/pandas_gbq/gbq.py", line 532, in run_query
    return self._download_results(
  File "/home/portalwebtrafficjourneys/.local/lib/python3.8/site-packages/pandas_gbq/gbq.py", line 587, in _download_results
    df = rows_iter.to_dataframe(
  File "/home/portalwebtrafficjourneys/.local/lib/python3.8/site-packages/google/cloud/bigquery/table.py", line 1692, in to_dataframe
    record_batch = self.to_arrow(
  File "/home/portalwebtrafficjourneys/.local/lib/python3.8/site-packages/google/cloud/bigquery/table.py", line 1517, in to_arrow
    for record_batch in self._to_arrow_iterable(
  File "/home/portalwebtrafficjourneys/.local/lib/python3.8/site-packages/google/cloud/bigquery/table.py", line 1411, in _to_page_iterable
    for item in tabledata_list_download():
  File "/home/portalwebtrafficjourneys/.local/lib/python3.8/site-packages/google/cloud/bigquery/_pandas_helpers.py", line 513, in download_arrow_row_iterator
    yield _row_iterator_page_to_arrow(page, column_names, arrow_types)
  File "/home/portalwebtrafficjourneys/.local/lib/python3.8/site-packages/google/cloud/bigquery/_pandas_helpers.py", line 486, in _row_iterator_page_to_arrow
    arrays.append(pyarrow.array(page._columns[column_index], type=arrow_type))
AttributeError: 'NoneType' object has no attribute 'array'

Could you show relevant bit of code which defines bq_field / FullVisitorId?

hey i have plz help me i have a error

AttributeError: 'NoneType' object has no attribute 'filename'

plz solve it code is like this

from werkzeug.utils import secure_filename from flask import Flask, request, render_template, redirect, url_for import os

app = Flask(name) app.config["UPLOAD_FOLDER"]="/static" @app.route('/') def hello_world(): return 'Hello from Flask!'

@app.route('/upload',methods=["POST","GET"]) def upload(): if request.method=="POST": f=request.files.get("uploadfile") return f.filename

else:
    return render_template("up.html")

if name=="main": app.run()

f is None in your code. Probably because there is no "uploadfile" in the the request, so you're getting that error.