Reading a text file
My main.py is:
main.py -- put your code here!
print ("In main...")
print ("WiFi setup...")
print ("In ReadFile...")
file = open('02_250.txt', 'r')
Getting OSError Errno 2 ENOENT on file = open('02_250.txt', 'r')
I am returning to the SiPy after 6 months and I'm sure this worked back then.
@pmulvey three backticks start and end a code block,
Got myself in a muddle having the file in the PC window of WinSCP and not on the device! Thanks for the reply. Oh, what are the special characters that signify a code block (black background) on the forum?
@pmulvey The error code just tells that the file does not exist. I made such a file as "/flash/02_250.txt", and successfully tried the three lines:
file = open('02_250.txt', 'r') content=file.readlines() file.close()