[Tutor] Using os.popen()
Danny Yoo
dyoo at hkn.eecs.berkeley.edu
Thu Mar 9 01:05:52 CET 2006
Hi Victor,
Meta notes: if you're replying to a message, please make sure that message
is relevant to what you're asking. You just replied to the digest and
included its whole contents back at the list, which is not useful. In
this particular case, it makes more sense to send a new message to the
mailing list, not a reply to the archive.
Furthermore, please try to make the subject line relevant to your
question. I've changed it to 'Connection to a database', since that's
what you're asking about.
I'm a stickler for these things because doing these things makes the
archive at:
http://mail.python.org/pipermail/tutor/2006-March/thread.html#start
more pleasant. If all the messages in that archive were labeled as
"Re: [Tutor] Tutor Digest, Vol 25, Issue 18", that would greatly reduce
the usefulness of the archive.
Anyway, to your question:
> I need help to connect to db on Linux machine.
> When I do it manually -all right, try to execute script does not work.
> My script is simple:
> -------------------------------------------------------
> def Connect3():
> arg=os.popen('sql.py --prompt qa2:adsdb
> inbl27,inbl27,inbl27:root:adsgoogle:qa2ads0,qa2ads1')
Can you be more specific than "does not work"? Do you see a syntax or
runtime error, or nothing, or...? Do you see any output at all?
I'm trying to impress the idea that many of us on the list are not
psychic. You have to help us with our shortcomings! *grin*
I'll assume for the moment that you're using some kind of Unix. What
happens if you type:
$ sql.py --prompt ...
at that directory? I would be surprised if this worked, because your path
should not include your current working directory unless you've changed it
explicitly.
Anyway, good luck to you!
More information about the Tutor
mailing list