I have been trying to read a simple two line text file from a remote server using ftplib. The simple script shown below works fine from my Ubuntu laptop but will not work from my Raspberry Pi's.
#! /usr/bin/env python
import ftplib
ftp = ftplib.FTP('my_ftp_host','my_ftp_username','my_ftp_password')
myfiles = ftp.dir()
print myfiles
read_file = open("songs.txt", "r")
my_file_data = read_file.readlines()
print my_file_data[0]
print my_file_data[1]
read_file.close()
ftp.quit()
Below is a screenshot of my terminal window on my Raspberry Pi where I get this error even though the file (songs.txt) is there?
Traceback (most recent call last):
File "read_test.py", line 11, in <module>
read_file = open("songs.txt", "r")
IOError: [Errno 2] No such file or directory: 'songs.txt'
And the picture below is from the terminal screen on my laptop which works fine.
I have tested on both model A (wifi) and model B (wired) running the latest version of Raspbian.
Both the Pi's and my laptop are using Python 2.7.3
I can not understand why this will work on my laptop and not from the Pi? Any help is very much appreciated, Kyle