os.system() not passing command line properly

Posted on 2006-04-18
Last Modified: 2008-02-26
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:
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?
Question by:undata

    Author Comment


    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?
    LVL 15

    Expert Comment

    Site help for "I answered my question myself. What do I do?":

    Accepted Solution

    PAQed with points refunded (500)

    Community Support Moderator

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Sequence is something that used to store data in it in very simple words. Let us just create a list first. To create a list first of all we need to give a name to our list which I have taken as “COURSE” followed by equals sign and finally enclosed …
    Article by: Swadhin
    Introduction of Lists in Python: There are six built-in types of sequences. Lists and tuples are the most common one. In this article we will see how to use Lists in python and how we can utilize it while doing our own program. In general we can al…
    Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
    Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now