LinkedIn-Bot
LinkedIn-Bot copied to clipboard
[Errno 22] Invalid argument
File "C:\Users\Martin\Desktop\LinkedIn-Bot-master\LinkedIn-Bot-master\LinkedInBot-Convert.py", line 556, in createCSV with open(os.path.join(os.path.dirname(os.path.realpath(file)), 'CSV', filename), 'w') as csvFile: OSError: [Errno 22] Invalid argument: 'C:\Users\Martin\Desktop\LinkedIn-Bot-master\LinkedIn-Bot-master\CSV\Linked-In-04:31:03.827482.csv'
update code with following in LinkedInBot-Convert.py :
def createCSV(data, time): ''' Creates an initial CSV file. data is the list that will get added to the file (in this case, it's the headers). time is the time at creation of this file. ''' formatted_time = time.replace(":", "_") # Replace colons with underscores filename = 'Linked-In-' + formatted_time + '.csv' with open(os.path.join(os.path.dirname(os.path.realpath(file)), 'CSV', filename), 'w') as csvFile: writer = csv.writer(csvFile) writer.writerow(data) csvFile.close()