After this topic Get a string in Shell/Python using sys.argv , I need to change my code, I need to use a subprocess in a main.py with this function :
def download_several_apps(self):subproc_two = subprocess.Popen(["./readtext.sh", self.inputFileName_download], stdout=subprocess.PIPE)
Here is my file readtext.sh
#!/bin/bash
filename="$1"
counter=1
while IFS=: true; doline=''read -r lineif [ -z "$line" ]; thenbreakfipython3 ./download.py \-c ./credentials.json \--blobs \"$line"
done < "$filename"
And my download.py
file
if (len(sys.argv) == 2):downloaded_apk_default_location = 'Downloads/'else:readtextarg = os.popen("ps " + str(os.getppid()) + " | awk ' { out = \"\"; for(i = 6; i <= NF; i++) out = out$i\" \" } END { print out } ' ").read()textarg = readtextarg.split(" ")[1 : -1][0]downloaded_apk_default_location = 'Downloads/'+textarg[1:]
How can I get and print self.inputFileName_download
in my download.py file ?
I used sys.argv as answerd by @tripleee in my previous post but it doesn't work as I need.