Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > os.system behavior when calling SQLPlus with spooling

Reply
Thread Tools

os.system behavior when calling SQLPlus with spooling

 
 
steve551979@hotmail.com
Guest
Posts: n/a
 
      01-24-2008
I'm trying to execute SQLPlus in python (on Redhat linux).

when calling sqlplus, i'm referencing an sql file which spools results
to a file, for e.g.:

spool "/tmp/qctemp2.out";
SELECT %s
FROM bug
WHERE BG_BUG_ID = %s;
spool off;
exit;


I'm noticing that when using:

os.system("sqlplus -S -L %s @/tmp/qctemp3.sql" % qc_login)

I'm able to execute fine, however, when I use:

f = popen4(("sqlplus -S -L %s @/tmp/qctemp3.sql" % qc_login)
print f.read()

I get problems where occasionally, sqlplus is run, but has problems
spooling results to a file, and python hangs on the print f.read()
statement.

I would prefer not to use os.system() since I want to analyze the
results. Can anyone suggest how I should go about executing sqlplus
in this case?

Thanks for your help,
Steve

(note: please do not reply to my email address, only reply to this
group)
 
Reply With Quote
 
 
 
 
Martin v. L÷wis
Guest
Posts: n/a
 
      01-24-2008
> I would prefer not to use os.system() since I want to analyze the
> results. Can anyone suggest how I should go about executing sqlplus
> in this case?


You need to find out why it hangs. Perhaps sqlplus tries to read from
its stdin, asking the user for input, yet your script doesn't provide
any?

You can use "strace -p <id of sqlplus>" to find out what it's doing
when it hangs.

Regards,
Martin
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
spooling right to a printer dfetrow410@hotmail.com ASP .Net 0 02-22-2006 02:45 PM
Sqlplus - S stops ...sigh ! Gianni Perl 4 07-01-2004 04:38 PM
Sqlplus -S interrupt !!!! Gianni Perl 0 06-17-2004 02:01 PM
mac spooling problem john in mtl Computer Support 1 02-11-2004 03:06 AM
Spooling belto Computer Support 3 11-03-2003 06:05 PM



Advertisments