You are mixing python and environment variables.
When you use ${fname}
, bash considers fname
an environment variable, something known by your OS. Since it is not defined, it will use an empty value, thus, not finding the file.
You either need to define fname
in your terminal and them call it in python, as in the question:
export fname='2020-10-29 - All computers.xls'
python your_code.py
Also, you need to add the flag shell=True
when you call subprocess.call
Or define it entirely in python:
fname='2020-10-29 - All computers.xls'
proc=subprocess.call(
["lftp", "-u", "user:password", "ftps://servername:990", "-e",
"set ftp:ssl-protect-data true; set ftp:ssl-force true; "
"set ssl:verify-certificate no;get " + fname])
CLICK HERE to find out more related problems solutions.