I have a running python program I wrote in thonny. Everything worked perfectly fine, when I ran it from the IDE and the terminal.
I run SSH on the Raspberry Pi I'm using for this application to start my program. Then I tried using SFTP to download the files the program puts out.
This worked too, but when I tried to start the program again, it suddenly errored out at (4th line, rest for context):
#PYGAME SETUP FOR SOUNDS
pygame.init()
pygame.mixer.init()
shuttersound = pygame.mixer.Sound('Shutter.wav')
savesound = pygame.mixer.Sound('Save.wav')
with:
Traceback (most recent call last):
File "/home/pi/Desktop/PictographBox/PictographBox_v1.1.py", line 19, in <module>
shuttersound = pygame.mixer.Sound('Shutter.wav')
pygame.error: Unable to open file 'Shutter.wav'
although the sound file remained unchanged. I could still run the program perfectly fine from thonny.
I ran "dos2unix" on my script and it worked as expected again.
So I tried to use SFTP again and that produced the exact same problem on the same line (again fixed by "dos2unix").
I need to prevent this from happening, as downloading the files is crucial. I first thought it was my FTP client, but I tried three different clients which produced the exact same result. I didn't even open or otherwise touch the script with SFTP, just went into the folder. Do I have a problem in my script? All line breaks look fine.
No other files have problems, only my script and only after opening it's folder via SFTP.