This fixes issue #1 #2

Open
j wants to merge 123 commits from Branch_Karen into main
Showing only changes of commit b8a4875e9d - Show all commits
+5 -2
View File
@@ -41,7 +41,7 @@ subscription = subscriber.create_subscription(
# Publish a message to the topic # Publish a message to the topic
# Read the data from the csv file # Read the data from the csv file
# file_path = "C:/Users/Karen/Desktop/zipcodes.csv" # file_path = "C:/Users/Karen/Desktop/zipcodes.csv"
file_path = "C:/Users/Karen/Desktop/zipcodes.csv" file_path = "zipcodes.csv"
with open(file_path, "r") as csv_file: with open(file_path, "r") as csv_file:
reader = csv.reader(csv_file) reader = csv.reader(csv_file)
@@ -49,7 +49,10 @@ with open(file_path, "r") as csv_file:
for row in reader: for row in reader:
# Format the data as a string and publish it to the topic # Format the data as a string and publish it to the topic
data = ",".join(row).encode("utf-8") data = ",".join(row).encode("utf-8")
future = publisher.publish(topic_path, data) try:
future = publisher.publish(topic_path, data)
except DeadlineExceeded as de:
print(f"Caught DeadlineExceeded exception: {de}")
print(f"Published message ID {future.result()}") print(f"Published message ID {future.result()}")
''' '''