Due to high demand expect some shipping delays at this time, orders may not ship for 1-2 business days.
0

Mac OS & CIRCUITPY
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Mac OS & CIRCUITPY

by akbykraz on Mon Mar 01, 2021 9:22 pm

Am working on a couple of projects (MagTag Project Selector[Rocket Launch] & Matrix Portal[Weather]) ...
In attempting 2 switch from 1 project 2 the other (brain fog clearing), I tried having both devices attached
2 my iMac ... I have renamed my project devices after the project name (& not CIRCUITPY) ... Discovered that
MU doesn't know anything except CIRCUITPY which is just a little annoying when opening 2 enable code
editing ... My confusion is over the inability 2 have or more than one circuit python drive connected 2 my
iMac at the same time and be able 2 move back and forth between projects, when needed ... I have 2 eject
the mounted driver, exit Mu, reconnect the drive I want to work on, & then open Mu again ... Not particularly
efficient for my method of coding/experimenting/learning ... Is this a limitation in circuit python ? ... The limitation
imposed by Mu will have 2 be my bane as the feedback coding error report is a necessary feature 4 me as I'm
not a strong Python coder ...
Thanks,
Skip

akbykraz
 
Posts: 34
Joined: Sat Sep 12, 2020 4:00 pm

Re: Mac OS & CIRCUITPY

by mikeysklar on Tue Mar 02, 2021 7:53 pm

Skip,

Based on your post I looked to see if we had an elegant solution and saw that in our CircuitPython guide we encourage CIRCUITPY renaming and the following section is editing code (primarily with MU) which I guess does not really support a renamed CIRCUITPY.

Since you are on a MAC maybe thing thing to do is create and remove symlinks when switching projects?

Code: Select all | TOGGLE FULL SIZE
sudo ln -s /dev/CIRCUITPY /dev/MAGTAG

and when you switch to the weather portal device...delete the symlink and create a new one:

Code: Select all | TOGGLE FULL SIZE
sudo rm /dev/CIRCUITPY
sudo ln -s /dev/CIRCUITPY /dev/MATRIXPORTAL


I realize this is kind of manual, but it might be easy to include this in the CIRCUITPY/boot.py startup script if the above is a usable solution.

https://learn.adafruit.com/welcome-to-c ... 3014813-19

mikeysklar
 
Posts: 4154
Joined: Mon Aug 01, 2016 8:10 pm

Re: Mac OS & CIRCUITPY

by akbykraz on Tue Mar 02, 2021 8:22 pm

OK ... I suspected there wouldn't B an elegant solution but will give your suggestion on the symlink
solution (its better than the brute force of eject/plug back in) a try ... Can probably automate that with
a Mac OS 'trick' ... Am not above a 'quick & dirty' shortcut ... Thanks for the info on the symlink also ...
Was not aware of that part of the Mac OS ... Guess I'm learning more than just CircurtPython ...
Thanks for the help

Skip

akbykraz
 
Posts: 34
Joined: Sat Sep 12, 2020 4:00 pm

Re: Mac OS & CIRCUITPY

by tannewt on Wed Mar 03, 2021 1:11 pm

Mu is meant for beginners and this sounds more advanced. I'd recommend using a different text editor that can have both code.py's open at once. Then, you can have two screens open as well.

Using another editor is documented here: https://learn.adafruit.com/welcome-to-c ... 2977444-22

Using screen is here: https://learn.adafruit.com/welcome-to-c ... -and-linux

tannewt
 
Posts: 2389
Joined: Thu Oct 06, 2016 8:48 pm

Re: Mac OS & CIRCUITPY

by mikeysklar on Wed Mar 03, 2021 3:32 pm

I like @tannewt suggestion of screen and a different editor. I've been really happy working on multiple CircuitPython devices on my MacOS box using vim and screen. No symlinks the drive numbers will just enumerate "CIRCUITPY 1" "CIRCUITPY 2" etc.

mikeysklar
 
Posts: 4154
Joined: Mon Aug 01, 2016 8:10 pm

Re: Mac OS & CIRCUITPY

by akbykraz on Wed Mar 03, 2021 3:56 pm

OK ... I do use BBEdit for other things as well as looking @ other code for ideas
or possible inclusion in the project I'm working on ... I was using Mu because of
the feedback that the REPL gives ... I'm really new to Circuitpython, Python, Javascript,
C (& its derivatives) ... My last coding expertise stopped @ Pascal ('90's) after doing
systems management along with software development with the major programming
languages of the '60's, '70's & '80's ... Slowly coming along but this old brain is really
slow @ picking up some of the nuances of this object programming ... Luckily most of
this code is open source & can B shared ... I've been doing a lot of 'code copying' &
concept gleaning ... Thanks for the info ... Will explore some other editors ...

Thanks,
Skip

akbykraz
 
Posts: 34
Joined: Sat Sep 12, 2020 4:00 pm

Re: Mac OS & CIRCUITPY

by akbykraz on Tue Mar 09, 2021 10:20 pm

@mikeysklar ... No joy on using a symlink in Mac Catalina ... MU appears to ignore the symlink ... However,
I did find adafruit.py source code buried in the MU package ... I CAN add personally named volumes that
I use to indicate which project I might be working on ... Currently my modified adafruit.py mode file is set
to find whichever board is mounted & open said drive ... Would like to have it ask me for the volume
name that I want to open but haven't got the skills (yet) to code that part ... For now, I can switch between
projects & still use the REPL for my debugging ... My coding brain is still working conceptually with the
'enter code', 'save code', 'run' from my many years of Basic coding ...

Thanks for all the help,
Skip

akbykraz
 
Posts: 34
Joined: Sat Sep 12, 2020 4:00 pm

Re: Mac OS & CIRCUITPY

by mikeysklar on Wed Mar 10, 2021 3:27 pm

@Skip,

Thanks for the MU adafruit.py tip. Glad you got a semi-workable solution for editing the renamed CIRCUITPY drives.

mikeysklar
 
Posts: 4154
Joined: Mon Aug 01, 2016 8:10 pm

Re: Mac OS & CIRCUITPY

by akbykraz on Tue Mar 16, 2021 11:33 pm

@mikeysklar ... Re: Mu adafruit.py ... The current 1.x version of Mu has completely changed
the coding structure of the Mu package ... adafruit.py is gone & half-a-dozen Circuitpy boards
are now going to B incorporated into the Mu package ... Did run across a unintended
consequence (no code kludging goes unpunished ... lol) ... Mu will not connect REPL 2 another
renamed 'Ciruitpy' drive after your 1st connect ... I'm just gonna' have 2 find another means of
getting the REPL output in another editor ... Not lookin' forward 2 the search or learning a
new, more complicated editor ... :-(

Thanks 4 all your help,
Skip

akbykraz
 
Posts: 34
Joined: Sat Sep 12, 2020 4:00 pm

Re: Mac OS & CIRCUITPY

by mikeysklar on Wed Mar 17, 2021 3:46 pm

I've been using screen to grab the REPL in a Terminal and vim to edit code. Pretty much doing the same thing on all platforms for the last 30 years with no complaints. These command-line / curses based tools are always avialable. Maybe you don't need a super fancy IDE tool. It sounds like you have graduated to the next level of editor needs.

mikeysklar
 
Posts: 4154
Joined: Mon Aug 01, 2016 8:10 pm

Re: Mac OS & CIRCUITPY

by akbykraz on Wed Mar 17, 2021 4:40 pm

@mikeysklar ... Interesting you should mention the screen command in terminal ... Was just playing with
the command (found tidbits in one of the Circuitpython guides) ... I've got two windows watching the outputs from
two of my Portal Matricies as I type ... gonna' B exploring the 'spaces' capabilities of mac catalina so I can have
the terminals monitoring my 2 projects (or more) for crashing ... I think my brain cells have started to wake up
after all these years of non-use & R starting to connect some dots on coding that have long been in a non-use
state ... Thanks 4 the info on the screen command ... I'll B refining my use of it ...

Thanks,
Skip

akbykraz
 
Posts: 34
Joined: Sat Sep 12, 2020 4:00 pm

Re: Mac OS & CIRCUITPY

by mikeysklar on Thu Mar 18, 2021 4:28 pm

@Skip,

Terminal junkies will agree that a power user needs to utilize screen. I often run double and triple nested screens (title bar on) to manage all aspects of my command line shenanigans. I'm including my .screenrc and a screenshot to give you an idea. I use
Code: Select all | TOGGLE FULL SIZE
screen -x
to resume all the sessions remotely so every computer / phone / pi in my life has access to all the screen sessions.

.screenrc
Code: Select all | TOGGLE FULL SIZE
defscrollback 100000
attrcolor d "b"
attrcolor u "G"
attrcolor s "= kR"
attrcolor r "k"
attrcolor B "Y"
caption always '%{G}%D %Y %M %d %C%a %{kR} %-w%{Y}%2n %t%{-}%+w'
bind b eval "writebuf" "exec sh -c 'pbcopy < /tmp/screen-exchange'"
bind v eval "exec sh -c 'pbpaste > /tmp/screen-exchange'" "readbuf"
#attrcolor b "C"


Screen Shot 2021-03-18 at 1.24.01 PM.png
Screen Shot 2021-03-18 at 1.24.01 PM.png (2.46 MiB) Viewed 31 times

mikeysklar
 
Posts: 4154
Joined: Mon Aug 01, 2016 8:10 pm

Please be positive and constructive with your questions and comments.