0

Adafruit Feather M0 Express / MU not running scripts any lon
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Adafruit Feather M0 Express / MU not running scripts any lon

by pglelko on Tue May 14, 2019 5:48 pm

Hello,
I purchased a Adafruit Feather M0 Express (PN: 3403) to learn software (i.e. python / circuit python) and have some fun experimenting. It was working and now is it is not.

Background:
I followed all the steps on "Welcome to Circuit Python" and went through most of the "Circuit Python Essentials". I had all the example scripts running from the two previously mentioned pages.

I purchased the DS3231 RTC FeatherWing to experiment with and tried the example that is in the examples folder. After making the few changes it suggests, I never could get it to work. I finally, out of frustration went back to the very basics (the first script in Welcome to Circuit Python) and still nothing was working. I followed the directions, reset the Feather M0 Express, reloaded CircuitPython with version 3.1.2. I see CIRCUITPY drive like I should, but even if I run the very basic script that is in the attached Notepad file, it will not run as it should and did previously.
Running Check shows no problems found.
Any pointers on what to do?? I thought it might be an issue with the new DS3231 RTC Feather, but I have since removed that and still have the same issue.

Thank you
Paul

pglelko
 
Posts: 9
Joined: Thu Apr 25, 2019 4:25 pm

Re: Adafruit Feather M0 Express / MU not running scripts any

by pglelko on Tue May 14, 2019 5:53 pm

Well when I try to upload the .txt file, it blocks me and I cannot have the script in the post either.

So, for reference even if I run the first script in the Welcome to CircuitPython tutorial under Creating and Editing Code, I see the following in serial console:

soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
File "code.py", line 1
SyntaxError: invalid syntax


Press any key to enter the REPL. Use CTRL-D to reload.

pglelko
 
Posts: 9
Joined: Thu Apr 25, 2019 4:25 pm

Re: Adafruit Feather M0 Express / MU not running scripts any

by kevinjwalters on Tue May 14, 2019 6:49 pm

You can place code inside the post and use selection and then the [CODE] button to mark/format it.

Do you have any whitespace before your first line in that file? Python is very sensitive to leading whitespace on lines because it uses identation to "group" code.

kevinjwalters
 
Posts: 325
Joined: Sun Oct 01, 2017 3:15 pm

Re: Adafruit Feather M0 Express / MU not running scripts any

by pglelko on Tue May 14, 2019 7:14 pm

Thank you for that information Kevin!
Well, tried selecting/highlighting it once it was in the post and then clicking on the
Code: Select all | TOGGLE FULL SIZE
 button. The [code] and
framed it, but still get that big red denied screen when I press submit.

I do not have any whitespace before the first line. It is a straight copy from the Welcome to CircuitPython tutorial.
Attachments
CP_code.jpg
CP_code.jpg (44.33 KiB) Viewed 102 times

pglelko
 
Posts: 9
Joined: Thu Apr 25, 2019 4:25 pm

Re: Adafruit Feather M0 Express / MU not running scripts any

by danhalbert on Tue May 14, 2019 7:19 pm

Notepad is not a good editor to use on Windows because it does not write out the file completely immediately. We recommend Mu or some other editors. See this section in the starting Learn Guide: https://learn.adafruit.com/welcome-to-c ... ve-it-7-13

To paste code here, paste it in whitespace (from your editor, not the online example), select all the code, and then click the [ CODE ] button. You don't need to attach it if you do that.

danhalbert
 
Posts: 1642
Joined: Tue Aug 08, 2017 12:37 pm

Re: Adafruit Feather M0 Express / MU not running scripts any

by adafruit_support_carter on Tue May 14, 2019 7:23 pm

Example of posting code:
code.jpg
code.jpg (3.98 KiB) Viewed 101 times

will look like this:
Code: Select all | TOGGLE FULL SIZE
This is the code

adafruit_support_carter
 
Posts: 11091
Joined: Tue Nov 29, 2016 2:45 pm

Re: Adafruit Feather M0 Express / MU not running scripts any

by pglelko on Tue May 14, 2019 7:45 pm

Thank you. I guess I am just not doing something correct, because I still get the red "you are blocked" page.
For the record, I am using Mu to code and have been since I started since it was the recommended editor in the tutorial.

I copy the code directly from Mu, paste it here, select all the code, and then click the [ CODE ] button. I see the bracketed code on the first line and then the bracketed /code on the last line (each by themselves). However, it still blocks even when copied directly from Mu.
Last edited by pglelko on Tue May 14, 2019 7:49 pm, edited 1 time in total.

pglelko
 
Posts: 9
Joined: Thu Apr 25, 2019 4:25 pm

Re: Adafruit Feather M0 Express / MU not running scripts any

by adafruit_support_carter on Tue May 14, 2019 7:48 pm

Are you able to open the serial console and see the REPL prompt? May help to try things interactively.
https://learn.adafruit.com/welcome-to-c ... ing-mu-8-4
https://learn.adafruit.com/welcome-to-c ... n/the-repl

adafruit_support_carter
 
Posts: 11091
Joined: Tue Nov 29, 2016 2:45 pm

Re: Adafruit Feather M0 Express / MU not running scripts any

by pglelko on Tue May 14, 2019 7:56 pm

I am able to and have been using the serial console to try to debug with the little I know.
I used the REPL command line and entered each line manually. No errors on screen, but no blinking red LED either on the Feather M0.

pglelko
 
Posts: 9
Joined: Thu Apr 25, 2019 4:25 pm

Re: Adafruit Feather M0 Express / MU not running scripts any

by adafruit_support_carter on Tue May 14, 2019 8:08 pm

It sounds like something is just off with the file. Since you can connect to the REPL and enter the commands and it works, the board is generally OK. So that's good.

Try just saving something totally different to code.py. Even just this:
Code: Select all | TOGGLE FULL SIZE
print("hello")

and see what happens.

adafruit_support_carter
 
Posts: 11091
Joined: Tue Nov 29, 2016 2:45 pm

Re: Adafruit Feather M0 Express / MU not running scripts any

by pglelko on Wed May 15, 2019 2:38 pm

if I save print("hello") to code.py, it does nothing but show the original error in the serial console.

If I type print("hello") in REPL, then that works and I see hello in the serial console.

I tried uninstalling and reinstalling Mu and still have the original issue.

pglelko
 
Posts: 9
Joined: Thu Apr 25, 2019 4:25 pm

Re: Adafruit Feather M0 Express / MU not running scripts any

by adafruit_support_carter on Wed May 15, 2019 4:39 pm

I'm thinking you might have multiple code.* files in your CIRCUITPY folder and Windows (you are on Windows?) is hiding some, or hiding extensions, or some other Windows thing. So we are editting something different then what is getting run with each software reset. So not really a Mu issue.

Can you use your file Explorer and look for all files that start with code or main in your CIRCUITPY folder.

adafruit_support_carter
 
Posts: 11091
Joined: Tue Nov 29, 2016 2:45 pm

Re: Adafruit Feather M0 Express / MU not running scripts any

by pglelko on Wed May 15, 2019 5:10 pm

Yes, I am running Windows 10, x64, Home version. I should have stated that, sorry.

Earlier this afternoon I ended up completely erasing the board via storage.erase_filesystem() after importing storage. I then reinstalled CP 3.1.2
Part of the original issue is gone. I no longer see the following in serial console:

code.py output:
Traceback (most recent call last):
File "code.py", line 1
SyntaxError: invalid syntax


However, I still do not see hello when even running print("hello") from a script in Mu. The following is all that appears in serial console after saving print("hello") in Mu:
soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.

Press any key to enter the REPL. Use CTRL-D to reload.

Adafruit CircuitPython 3.1.2 on 2019-01-07; Adafruit Feather M0 Express with samd21g18
>>>
Attachments
CP_drive_after_erasing.png
CP_drive_after_erasing.png (30.49 KiB) Viewed 49 times

pglelko
 
Posts: 9
Joined: Thu Apr 25, 2019 4:25 pm

Re: Adafruit Feather M0 Express / MU not running scripts any

by adafruit_support_carter on Thu May 16, 2019 11:45 am

OK, using storage.erase_filesystem() is also fine. That essentially erased and cleaned up the entire filesystem in the CIRCUITPY folder and reset it back to its initial (and known) state. Your screen capture of the file explorer window looks as expected.

And it also removed whatever was actually being run with a soft reboot and causing the error message you were getting.

Now you just need to try again to save your code. But there are only a few specific file names that will "auto" run. See here:
https://learn.adafruit.com/welcome-to-c ... -file-7-30
test.py is not one of those names, try code.py instead.

Without one of those files present, there is no code to auto run, so the board just drops into the REPL. Which is what you are seeing here:
Code: Select all | TOGGLE FULL SIZE
Adafruit CircuitPython 3.1.2 on 2019-01-07; Adafruit Feather M0 Express with samd21g18
>>>

adafruit_support_carter
 
Posts: 11091
Joined: Tue Nov 29, 2016 2:45 pm

Re: Adafruit Feather M0 Express / MU not running scripts any

by pglelko on Thu May 16, 2019 1:27 pm

Well I feel that was a waste of everyone's time.
That, changing my script name from test to code, was the solution...at least after formatting it. Might have been a conflict before the formatting caused the issue as you mentioned.

Previously i had been using the code.py for all my test scripts, but when I ventured into writing my own I just called it test. So going forward, per the info you sent, CP will only recognize those four file names as scripts? So when I move on to writing my own scripts I have to use something other than CP if I want to use script names other than the four listed correct?

Sincerely, thanks for the help and sorry for the churn on something I should have known/remembered from reading the tutorials.

pglelko
 
Posts: 9
Joined: Thu Apr 25, 2019 4:25 pm

Please be positive and constructive with your questions and comments.