[Tutor] Executing shell commands
Phil
phillor9 at gmail.com
Sat Feb 15 19:42:22 EST 2020
Thank you for reading this.
Python3 on Linux.
I'm looking for ideas on how I might collect some .gpx files and then
upload them to a serial device as a batch via a for-loop mechanism.
Uploading the files one at a time is quite straight forward, no problems
there.
I thought I might start with something like this and then collect the
file names in a list and then upload them one by one. However, I'm
missing a step from the listing of the file names and then collecting
them. Plus the following fails with a directory does not exist error
even though executing the same command "ls /home/phil/Downloads/*.gpx"
from the command line shows that there isn't a problem.
import subprocess
subprocess.call(["ls", "/home/phil/Downloads/*.gpx"])
The above fails but the following is OK.
subprocess.call(["ls", "/home/phil/Downloads/GC1BPG4.gpx"])
Any suggestion on how I might at least make a start will be greatly
appreciated.
--
Regards,
Phil
More information about the Tutor
mailing list