I have 2 linux machines (raspberry pis), one set up as a NAS server, and another one which will run a script for me.
The goal: I would like to have the one raspberry pi use python to write a .csv file to an already mounted directory. That way, after the script is completed and the file is written to the shared folder, I will then be able to access the .csv file from my windows computer on the same network.
As it stands now, I can see the Samba share from my windows computer, but I can not figure out how to make python write the file to that shared location instead of the pi's desktop.
This is the code I have that writes it to the desktop:
outputFile = open('lights.csv', 'w')
for i in range(len(button_array)):
#Convert the button's time_on variable to a string and append a comma and newline.
outputFile.write(str(button_array[i].total_time_on) + ',\n')
So for this specific example, lets say that I have mounted a directory /mnt/My_Network_Drive to the server pi at //hostname/Folder.
Does anyone know how to fix my code? And if there is something else I am missing, I would appreciate hearing that too. I am still very new to linux, networking, and python, and I would appreciate any input.