469,267 Members | 1,094 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,267 developers. It's quick & easy.

using Python to run other programs

Hi, i'm not a programmer so I have a very stupid question. I'm trying to
make a practical script. I need to run an executable program in it but i
can't get it to work. Maybe someone here can figure it out easily:

-----
#! /python

a = (recipient's e-mail address)

pgp -feat a

(sendmail to address after encryption)
------

How do I get python to open the pgp program?

Should I use an environment other than python?

thanks!
Jul 18 '05 #1
10 10831
hi,
using python to run shell commands is very easy.
all you need to do is create the command line you would want to run. in your
case:
command = "pgp -feat " + a
and then run it using os.system(), like this:
import os
os.system(command)
if you also want to get the output of the command, you can use the
'commands' module, like this:
import commands

output, rc = commands.getoutput(command)

then you get the output into the variable 'output', and the exit code of the
program into the variable 'rc'.

sagiv.
"Frog" <Fr**********@bigfoot.com> wrote in message
news:7T**********************@Gilgamesh-frog.org...
Hi, i'm not a programmer so I have a very stupid question. I'm trying to
make a practical script. I need to run an executable program in it but i
can't get it to work. Maybe someone here can figure it out easily:

-----
#! /python

a = (recipient's e-mail address)

pgp -feat a

(sendmail to address after encryption)
------

How do I get python to open the pgp program?

Should I use an environment other than python?

thanks!

Jul 18 '05 #2
Download Duplicity, there's a nice GnuPG module in it, which would also
demonstrate the technique how this can be done.

http://www.nongnu.org/duplicity

To send e-mail is pretty easy by using the standard library. Have a look at
the tutorial which comes with your Python installation.

Best,
Miklós

Frog <Fr**********@bigfoot.com> wrote in message
news:7T**********************@Gilgamesh-frog.org...
Hi, i'm not a programmer so I have a very stupid question. I'm trying to
make a practical script. I need to run an executable program in it but i
can't get it to work. Maybe someone here can figure it out easily:

-----
#! /python

a = (recipient's e-mail address)

pgp -feat a

(sendmail to address after encryption)
------

How do I get python to open the pgp program?

Should I use an environment other than python?

thanks!

Jul 18 '05 #3
This is the 3rd time I've downloaded, installed and tried Boa. Each time I
meet with one frustration or another. This time I'm trying to go thru the
Getting Started, and find numerous places that the tutorial does not agree
with the reality or I try something and it does not work.

Has anyone had success with Boa Constructor? If so how did you learn it?
The tutorial clearly is not the way I can learn it.

Bob Gailer
bg*****@alum.rpi.edu
303 442 2625
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.538 / Virus Database: 333 - Release Date: 11/10/2003

Jul 18 '05 #4
Bob Gailer <bg*****@alum.rpi.edu> wrote in message news:<ma************************************@pytho n.org>...
This is the 3rd time I've downloaded, installed and tried Boa. Each time I
meet with one frustration or another. This time I'm trying to go thru the
Getting Started, and find numerous places that the tutorial does not agree
with the reality or I try something and it does not work.
I too found that the tutorial was inaccurate (perhaps just out of
date), but I was able to guess what to do instead. Do you have any
specific examples of problems that maybe myself or others could help
with?
Has anyone had success with Boa Constructor? If so how did you learn it?
The tutorial clearly is not the way I can learn it.


To be honest with you I gave up on Boa, the main reason being that it
doesn't support wxSizers, which are useful - and with which the visual
designer becomes less important anyway. But I can sympathise with your
frustration. I think that one downside of Python having such great
centralised documentation is that the other projects seem to be very
poorly documented by comparison! Tutorials tend to be out of date, and
a lot of the help I can find on various subjects seems to stop at
'hello world' and then jump directly to the tricks of the trade.

I am attempting to learn how to use wxPython from their mailing list,
from the demos that come with the package, and from the Wiki
(http://wiki.wxpython.org/index.cgi/FrontPage). However, expect to
have to do a lot of cross-referencing, as I couldn't find anything
that could stand alone as a comprehensive guide.

--
Ben Sizer
Jul 18 '05 #5
Bob Gailer <bg*****@alum.rpi.edu> wrote in message news:<ma************************************@pytho n.org>...
This is the 3rd time I've downloaded, installed and tried Boa. Each time I
meet with one frustration or another. This time I'm trying to go thru the
Getting Started, and find numerous places that the tutorial does not agree
with the reality or I try something and it does not work.

Has anyone had success with Boa Constructor? If so how did you learn it?
The tutorial clearly is not the way I can learn it.

Bob Gailer
bg*****@alum.rpi.edu
303 442 2625

--


I too experience your frustration with boa. I finally figured it out
and now enjoy using it. Once you get your first interface built,
there's no stopping you. Remember to create your panel first, then you
can add controls and such to it.

Richard Bird
Jul 18 '05 #6
Bob Gailer wrote:
Has anyone had success with Boa Constructor? If so how did you learn it?
The tutorial clearly is not the way I can learn it.


I've never tried the tutorial. I just explored the program making some
bogus projects testing all the main features. Then, as I used it, kept
learning the rest of it.

Javier

Jul 18 '05 #7
Kylotan wrote:
Has anyone had success with Boa Constructor? If so how did you learn it?The tutorial clearly is not the way I can learn it.


To be honest with you I gave up on Boa, the main reason being that it
doesn't support wxSizers, which are useful - and with which the visual
designer becomes less important anyway.


Boa now supports wxSizers.

Javier


Jul 18 '05 #8
Javier Ruere <ja**********@HotPOP.com> wrote in message news:<ma************************************@pytho n.org>...
Boa now supports wxSizers.

Javier


The version I have is the same one that is available for download on
the website and seems to have absolutely nothing on wxSizers. In fact
I remember reading recently that there is preliminary support but it
is only in CVS. Perhaps that is what you mean?

--
Ben Sizer
Jul 18 '05 #9
Kylotan wrote:
Javier Ruere <ja**********@HotPOP.com> wrote in message news:<ma************************************@pytho n.org>...
Boa now supports wxSizers.

Javier


The version I have is the same one that is available for download on
the website and seems to have absolutely nothing on wxSizers. In fact
I remember reading recently that there is preliminary support but it
is only in CVS. Perhaps that is what you mean?


Yes, that's what I meant. Sizer were added in version 0.2.5 IIRC and
only 0.2.3 seems to be available.
I never used an application directly from CVS before Boa but, since
releases are so far apart and the quality of the code is so good, I
started using the checkout directly. I think it was a really good idea
in this particular case.

Javier
Jul 18 '05 #10
> Yes, that's what I meant. Sizer were added in version 0.2.5 IIRC and
only 0.2.3 seems to be available.
I never used an application directly from CVS before Boa but, since
releases are so far apart and the quality of the code is so good, I
started using the checkout directly. I think it was a really good idea
in this particular case.

Javier


The problem is that one is not able to chackout tha project, at least it
is not posiible from the place where im sitting. Is there any other way
than cvs to take a look at say, nightly builds?
Michal.
Jul 18 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Catalin | last post: by
1 post views Thread by Rami A. Kishek | last post: by
699 posts views Thread by mike420 | last post: by
28 posts views Thread by Maboroshi | last post: by
47 posts views Thread by Michael Scarlett | last post: by
114 posts views Thread by Maurice LING | last post: by
2 posts views Thread by Squirrel Havoc | last post: by
reply views Thread by Fuzzyman | last post: by
31 posts views Thread by Mark Dufour | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.