os.system() not passing command line properly

Posted on 2006-04-18
Medium Priority
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

ID: 16478288

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

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


Accepted Solution

GranMod earned 0 total points
ID: 16727418
PAQed with points refunded (500)

Community Support Moderator

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction On September 29, 2012, the Python 3.3.0 was released; nothing extremely unexpected,  yet another, better version of Python. But, if you work in Microsoft Windows, you should notice that the Python Launcher for Windows was introduced wi…
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 strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
Suggested Courses
Course of the Month9 days, 8 hours left to enroll

612 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