Fix twitter.py to read new directories

This commit is contained in:
newt 2024-10-09 18:02:31 +01:00
parent aeeac49182
commit 317531b098

View file

@ -1,11 +1,13 @@
import csv
import os
class Account:
def __init__(self, csvfile):
self.handle = csvfile[:-4]
self.bio = ''
self._tweets = []
with open(csvfile, 'r',encoding='utf-8') as file:
filePath = '{0}/{1}'.format(os.path.dirname(os.path.realpath(__file__)), csvfile)
with open(filePath, 'r',encoding='utf-8') as file:
reader = csv.reader(file)
first_row = 1
for row in reader:
@ -30,4 +32,4 @@ class Tweet:
self.text = tweet[0]
self.likes = int(tweet[1])
self.retweets = int(tweet[2])
self.date_time = tweet[3]
self.date_time = tweet[3]