Hi. I try to continue my smart Teddybear project with my CircuitPlayGround Bluefruit. When I start Mu Editor it says I can't save to disk anymore (permission denied). Windows says the CiruitPy disk is write-protected. There are 1.13 MB left on the disk. My code is still in there. I tried to disable writeprotection in windows, but with no success.
I have previously tried to enable CircuitPython to write to disk with this code, in which I had little success.
import board
import digitalio
import storage
switch = digitalio.DigitalInOut(board.D7)
switch.direction = digitalio.Direction.INPUT
switch.pull = digitalio.Pull.UP
# If the D0 is connected to ground with a wire
# CircuitPython can write to the drive
storage.remount("/", switch.value)
The last lines in the mu editor log says:
2021-07-04 15:28:37,240 - mu.logic:1189(save_tab_to_file) ERROR: [Errno 13] Permission denied: 'D:\\code.py'
2021-07-04 15:28:37,240 - mu.interface.main:942(show_message) DEBUG: Could not save file (disk problem)
2021-07-04 15:28:37,240 - mu.interface.main:943(show_message) DEBUG: Error saving file to disk. Ensure you have permission to write the file and sufficient disk space.
2021-07-04 15:30:48,513 - mu.logic:1394(show_admin) INFO: Showing admin with logs from C:\Users\fredmk\AppData\Local\python\mu\Logs\mu.log
2021-07-04 15:30:48,513 - mu.virtual_environment:788(installed_packages) INFO: Discovering installed third party modules in venv.
2021-07-04 15:30:49,105 - mu.virtual_environment:193(run) DEBUG: Process output: Package Version
---------------------- -------
adafruit-board-toolkit 1.0.1
backcall 0.2.0
bitstring 3.1.7
cffi 1.14.5
click 7.1.2
colorama 0.4.4
BANNED 3.4.7
decorator 5.0.7
ecdsa 0.16.1
esptool 3.0
Flask 1.1.2
ipykernel 5.5.3
ipython 7.22.0
ipython-genutils 0.2.0
itsdangerous 1.1.0
BANNED 0.18.0
Jinja2 2.11.3
jupyter-client 6.1.12
jupyter-core 4.7.1
MarkupSafe 1.1.1
numpy 1.20.2
parso 0.8.2
pgzero 1.2.1
pickleshare 0.7.5
pip 21.0.1
prompt-toolkit 3.0.18
pycparser 2.20
pygame 2.0.1
Pygments 2.8.1
pyserial 3.5
python-dateutil 2.8.1
pywin32 300
pyzmq 22.0.3
qtconsole 4.7.4
QtPy 1.9.0
reedsolo 1.5.4
setuptools 56.0.0
six 1.15.0
tornado 6.1
traitlets 5.0.5
wcwidth 0.2.5
Werkzeug 1.0.1
wheel 0.36.2
2021-07-04 15:30:49,105 - mu.virtual_environment:797(installed_packages) INFO: []
Permission denied: 'D:\\code.py'
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- dastels
- Posts: 15667
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Permission denied: 'D:\\code.py'
That code should work to selectively let CircuitPython write tot the file system by grounding D7 on power up or reset.
You put that code in boot.py?
Either than code has the file system in "writeable by CircuitPython" mode or the file system as become corrupted. See https://learn.adafruit.com/welcome-to-c ... 2978456-23
If it's readonly becasue of the storage.remount() call, you can undo it in the REPL:
In either case you can't do anything about it in Windows.
Dave
You put that code in boot.py?
Either than code has the file system in "writeable by CircuitPython" mode or the file system as become corrupted. See https://learn.adafruit.com/welcome-to-c ... 2978456-23
If it's readonly becasue of the storage.remount() call, you can undo it in the REPL:
Code: Select all
>>> import storage
>>> storage.remount("/", True)
Dave
- mirzam
- Posts: 5
- Joined: Wed Apr 08, 2015 1:49 pm
Re: Permission denied: 'D:\\code.py'
In my code.py code I pasted, I am assigning a value from the switch on CircuitPython BlueFruit. The problem resolved itself when I changed the switch position, haha.
I'm so sorry to bother you. And thank you very much Adafruit for quick reply and support!
I'm so sorry to bother you. And thank you very much Adafruit for quick reply and support!
- dastels
- Posts: 15667
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Permission denied: 'D:\\code.py'
Good stuff!
BTW code to control the writability should be in boot.py, not code.py.
Dave
BTW code to control the writability should be in boot.py, not code.py.
Dave
Please be positive and constructive with your questions and comments.