AttributeError(no data) during write_api.write

I am a InfluxDB/Flux newbie and am practicing my writes and queries. I am closely following the write scripts found both in the documentation and github. In fact, I’ve resorted to just copying the point created to avoid any silly errors. (I’ve xxxxxxxx for security reasons)

from influxdb_client import InfluxDBClient, Point
from influxdb_client.client.write_api import SYNCHRONOUS
from datetime import datetime

#Define variables with name of bucket, organization and token

token = "GtwWZXQg4HoPhRM3T2qrhY3W6WYKvAUNhDjuEZKBTLHXMhiAvlByNAUquu01wZfgusshAvJd6Bxxxxxxxxxxxx"

org = "bsmith@xxxxxxxxx.xx"
bucket = "jak_test_bucket"
url = url="https://us-east-1-1.aws.cloud2.influxdata.com"

#Instantiate the  client
client = influxdb_client.InfluxDBClient(url=url, token=token)

write_api = client.write_api(write_options=SYNCHRONOUS)

p = influxdb_client.Point("my_measurement").tag("location","Prague").field("temperature",25.3)

write_api.write(bucket = bucket, org = org, record = p)

As soon as the last line runs, the following error occurs.
Exception has occurred: AttributeError
‘NoneType’ object has no attribute ‘data’

Any help you could give me would be much appreciated!

This does not seem to me to be the full error message, Python usually outputs significantly more and should thus also give an indication of the object that could be causally the problem.

Check your Point variable p for its type and content.

Thanks for your imput. FYI, I found it was a certification error. I fixed the code by adding

import certifi ,

then added the ‘ssl_CA_cert=certifi.where()’ to my InfluxDBClient call. Does this seem to be the right thing to do?

Hi JulieK,
I am facing the same problem as yours. Could you please elaborate exactly where you have added ‘ssl_CA_cert=certifi.where()’ ?
I would also much appreciate it if you could provide the corrected version of above code.
Thanks