File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -48,15 +48,8 @@ def get_uf2_drives():
4848 uf2 .label = uf2_part ["label" ]
4949 uf2 .mountpoint = uf2_part ["mountpoint" ]
5050 yield uf2
51- elif (
52- disk ["type" ] == "disk"
53- and disk .get ("children" )
54- and len (disk .get ("children" )) > 0
55- ):
56- if (
57- disk .get ("children" )[0 ]["type" ] == "part"
58- and disk .get ("children" )[0 ]["fstype" ] == "vfat"
59- ):
51+ elif disk ["type" ] == "disk" and disk .get ("children" ) and len (disk .get ("children" )) > 0 :
52+ if disk .get ("children" )[0 ]["type" ] == "part" and disk .get ("children" )[0 ]["fstype" ] == "vfat" :
6053 uf2_part = disk .get ("children" )[0 ]
6154 # print( json.dumps(uf2_part, indent=4))
6255 uf2 = UF2Disk ()
@@ -75,7 +68,12 @@ def pmount(disk: UF2Disk):
7568 if not disk .label :
7669 disk .label = "UF2BOOT"
7770 disk .mountpoint = f"/media/{ disk .label } "
78- subprocess .run (["pmount" , disk .device_path , disk .mountpoint ])
71+ # capture error if pmount is not installed
72+ try :
73+ subprocess .run (["pmount" , disk .device_path , disk .mountpoint ])
74+ except FileNotFoundError :
75+ log .error ("pmount not found, please install it using 'sudo apt install pmount'" )
76+ return
7977 log .info (f"Mounted { disk .label } at { disk .mountpoint } " )
8078 glb_dismount_me .append (disk )
8179 else :
You can’t perform that action at this time.
0 commit comments