subprocess with variable for lftp [duplicate]

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'

Also, you need to add the flag shell=True when you call

Or define it entirely in python:

fname='2020-10-29 - All computers.xls'
    ["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.

Leave a Comment

Your email address will not be published.

Scroll to Top