Question

Good Day all

I am trying to run the following command, but receive various error's I know I have the incorrect syntax or possibly using an incorrect method, would any one be kind enough to point in the correct direction.

Thanks for any assistance

the actual external program path as in windows command line or batch script would be.

"c:\Program Files\SQL Anywhere 11\Bin32\dbbackup.exe" -c "DSN=demo2suite;UID=dba;PWD=sql" -y "D:\Databases\demo2\LIVE\LIVE_BCK"

Python V3.3

my part of the code for this mini(newbie) project would be.

def BackupDatabase():
    try:
        os.system('c://Program Files//SQL Anywhere 11//Bin32//dbbackup.exe -c "DSN=amos2suite;UID=dba;PWD=sql" -y "D://Databases//AMOS2//LIVE//LIVE_BCK"')
    except OSError as e:
        WriteLog("error",e) 
Was it helpful?

Solution

It's better to use subprocess module. Something like this:

import subprocess
subprocess.call(['c://Program Files//SQL Anywhere 11//Bin32//dbbackup.exe','-c',
'"DSN=demo2suite;UID=dba;PWD=sql"', '-y','"D://Databases//AMOS2//LIVE//LIVE_BCK"'])
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top