pico-ducky icon indicating copy to clipboard operation
pico-ducky copied to clipboard

Error creating new scripts on W

Open XtramCZ opened this issue 1 year ago • 5 comments

Describe the bug When i want to save a script on the Web UI, I get a crash

To Reproduce Steps to reproduce the behavior:

  1. Go to Web UI
  2. Click on New Script
  3. Name the script and put some code in there
  4. See error

Expected behavior I expected it to save my script

Screenshots -//-

Debug info Traceback (most recent call last): File "asyncio/core.py", line 246, in run_until_complete File "webapp.py", line 265, in startWebService File "wsgiserver.py", line 165, in update_poll File "adafruit_wsgi/wsgi_app.py", line 70, in call File "webapp.py", line 211, in write_new_script File "webapp.py", line 138, in cleanup_text File "webapp.py", line 138, in MemoryError: memory allocation failed, allocating 4168 bytes

Additional context It may be because I am currently messing with the css a lot and stuff

XtramCZ avatar Jul 02 '23 00:07 XtramCZ

I am currently working on debugging this with the Thonny IDE and the current issue is that it cannot edit the drive.

Debug Info {'scriptData': 'SCRIPT+HELLO+THERE', 'scriptName': 'Test.dd'}

Traceback (most recent call last):
  File "asyncio/core.py", line 246, in run_until_complete
  File "webapp.py", line 242, in startWebService
  File "wsgiserver.py", line 165, in update_poll
  File "adafruit_wsgi/wsgi_app.py", line 70, in __call__
  File "webapp.py", line 198, in write_new_script
RuntimeError: Cannot remount '/' when visible via USB.

Computeroid avatar Aug 01 '23 04:08 Computeroid

From my experience, your error only happens if you have USB mode enabled and try to modify a file

XtramCZ avatar Aug 01 '23 18:08 XtramCZ

You're right. For my purposes I need USB mode enabled so I just deleted the drive mount lines in create_new_script() and added a try-catch. It's not 100% safe but it works for me as I have backups.

Computeroid avatar Aug 02 '23 08:08 Computeroid

If USB Mass Storage mode is enabled, then the webapp cannot write to the internal flash. this is a limitation of circuitpython.

As for the original issue, do you have an example script that causes the problem? I'll try to take a look at this issue in the next couple of weeks.

dbisu avatar Aug 09 '23 04:08 dbisu

Nah, I haven't noticed this happening with a particular script, but it happens more with longer ones

XtramCZ avatar Aug 09 '23 15:08 XtramCZ