
Mrinal Chaudhary
Below is the code for the transactions/py file I am using and it results in error "Error: Instance of ‘PublisherClient’ has no ‘topic_path’ member"
import json
import csv
from google.cloud import pubsub_v1
project_name = ‘cmrinal_Sandbox’
topic_name = ‘purchases’
file = ‘MOCK_DATA.csv’
publisher = pubsub_v1.PublisherClient()
topic_path = publisher.topic_path(project_name, topic_name)
with open(file) as fh:
rd = csv.DictReader(fh, delimiter=’,’)
for row in rd:
data = json.dumps(dict(row))
publisher.publish(topic_path, data=data.encode(‘utf-8’))
1 Answers

Louis Eudo
I used pubsub instead of pubsub_v1 and it is working fine
Hi Louis, Even I have changed to pubsub instead ofpubsub_v1, I am getting this error "Instance of ‘PublisherClient’ has no ‘topic_path’ memberpylint(no-member)"