Link to home
Start Free TrialLog in
Avatar of undata
undata

asked on

os.system() not passing command line properly

I need to call Oracle Sql*Plus from a python script.  If I put the call to sql*plus like this:
os.system('sqlplus /NOLOG @my_script')
Then the @my_script will never get passed. Even if I put the line inside callit.bat and do:
os.system('callit.bat')
What happens is sqlplus starts but it does not execute the script. No amount of quoting helps.

It does always work like this :
os.system('start callit.bat')
However this opens another window and the python script resumes immediately.  Using
os.system('start /wait callit.bat') works exactly (wrong) as os.system('callit.bat'). It does wait but sqlplus starts up with no knowledge of the script, which contains the connect string.

Any of you geniuses figure this one out?
Avatar of undata
undata

ASKER

Nevermind.....

The *.sql file in question was actually being written by my script, and I never did a file.close().  Therefore windows apparently refused access to the file, with no messages or exception.  Screwed once again by Windows!
Question - do I get the 500 points for answering myself?
Site help for "I answered my question myself. What do I do?":

https://www.experts-exchange.com/help.jsp#hi70
ASKER CERTIFIED SOLUTION
Avatar of GranMod
GranMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial