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) 
有帮助吗?

解决方案

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"'])
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top