Using parted seems to trigger a reload of udev rules and so the device file goes missing briefly after it returns. This means that a) we should only use parted if we really have to; and b) include a short sleep after it to let udev to recreate the device files so the next process (e2label or mkfs) can find it.
Also, it's now recommended to use functions in module subprocess to run subprocesses instead of os.system and os.popen/popen3.
Using parted seems to trigger a reload of udev rules and so the device file goes missing briefly after it returns. This means that a) we should only use parted if we really have to; and b) include a short sleep after it to let udev to recreate the device files so the next process (e2label or mkfs) can find it.
Also, it's now recommended to use functions in module
subprocess
to run subprocesses instead ofos.system
andos.popen
/popen3
.