Error when trying to read a file
-
My WIPY3 gets OSError: [Errno 13] EACCES when trying to read a file. I've tried restoring if to factory settings and still. Some weeks ago it was fine, but I get this error since yesterday.
My code on main.py (boot.py is empty):
print('Ejecutando main.py...') import os f = open('datos','w') f.write('123') f.close() f = open('datos','w') f.read() f.close()This is what i get on console:
Uploading project (main folder)... Safe booting device... (see settings for more info) Uploading to /flash... Reading file status [1/1] Writing file main.py (0kb) Upload done, resetting board... OKets Jun 8 2016 00:22:57 rst:0x7 (TG0WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:1 load:0x3fff8020,len:8 load:0x3fff8028,len:2128 load:0x4009fa00,len:19760 entry 0x400a05bc Ejecutando boot.py... Ejecutando main.py... Traceback (most recent call last): File "main.py", line 9, in <module> OSError: [Errno 13] EACCES Pycom MicroPython 1.20.2.r3 [v1.11-044dfea] on 2020-12-23; WiPy with ESP32 Type "help()" for more information.I've tried updating the firmware, deleted /flash folder several times... seems like it doesnt have perms to read files on /flash, tho it can create the files (i've seen them on FTP)
any help please?
-
@Manuel-Martín said in Error when trying to read a file:
f = open('datos','w')
In line 8 you open the file in Write mode. Then you cannot read from it. You have to open it in read mode
f = open('datos','r')
-
my god... thank you very much. it works now, but I have another issue: when I try to download the file trough FTP, its always empty. can someone help me with that please?
-
@Manuel-Martín Hard to tell why.
Which ftp client are you using?
Can you download other files with ftp, like main.py. -
@robert-hh im accesing through a chrome tab window: ftp://192.168.0.14/flash/
after asking me user and password it allows me to see and access all the files, and can download all of them though they end up being as empty files in my computer -
@Manuel-Martín Try another ftp client, like filezilla. I have the same issue here with chrome. Filezilla works.
-
@robert-hh thank robert, with filezilla it works nice.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login