473,583 Members | 2,858 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 11040
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(comma nd)
if you also want to get the output of the command, you can use the
'commands' module, like this:
import commands

output, rc = commands.getout put(command)

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

sagiv.
"Frog" <Fr**********@b igfoot.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**********@b igfoot.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.rp i.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.r pi.edu> wrote in message news:<ma******* *************** **************@ python.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.r pi.edu> wrote in message news:<ma******* *************** **************@ python.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.rp i.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**********@H otPOP.com> wrote in message news:<ma******* *************** **************@ python.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**********@H otPOP.com> wrote in message news:<ma******* *************** **************@ python.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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
4989
by: Catalin | last post by:
How can I make executables with python? I found some utilities that claim they can do something like that like Installer and py2exe but they actualy pack the code in a huge arhive! This solves the problem of giving python programs to users who don't have python but doesn't solve the problem of the source "secrecy" (copyright). And the...
1
3712
by: Rami A. Kishek | last post by:
Please help! Very strange installation problem. First, let me say I successfully installed and use Python 2.2.3 and 2.3 from the EXE binaries on a win ME machine. That machine previously had 1.5.2, and now I have access to all 3 versions. When I tried to do the same on an older machine, however, running Win98 SE (and having had Python...
699
33653
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro capabilities, unfortunately. I'd like to know if it may be possible to add a powerful macro system to Python, while keeping its amazing syntax, and if it...
28
2580
by: Maboroshi | last post by:
Hi I am fairly new to programming but not as such that I am a total beginner From what I understand C and C++ are faster languages than Python. Is this because of Pythons ability to operate on almost any operating system? Or is there many other reasons why? I understand there is ansi/iso C and C++ and that ANSI/ISO Code will work on any...
47
3637
by: Michael Scarlett | last post by:
There is an amazing article by paul graham about python, and an even better discussion about it on slashdot. The reason I point this out, is the more I read both articles, the more I realised how we would be mutilating the language with that god forsaken @ decorator. I don't know about the rest of you, but I learned python and fell in love...
114
9760
by: Maurice LING | last post by:
This may be a dumb thing to ask, but besides the penalty for dynamic typing, is there any other real reasons that Python is slower than Java? maurice
2
1415
by: Squirrel Havoc | last post by:
Hello. I am sorry if this has been asked before, but I am new here. If I recall correctly, Python can be used as a scripting language for other programs, as if the program had a builtin Python interpreter. I wish to extend my programs by making them scriptable with Python scripts. Is this possible? If so, does anyone know where
8
4579
by: Joakim Persson | last post by:
Hello all. I am involved in a project where we have a desire to improve our software testing tools, and I'm in charge of looking for solutions regarding the logging of our software (originating from embedded devices). Currently, we are using a heavyweight, proprietary log tool developed by another part of the company. This tool contains all...
0
1554
by: Fuzzyman | last post by:
It's finally happened, `Movable Python <http://www.voidspace.org.uk/python/movpy/>`_ is finally released. Versions for Python 2.3 & 2.4 are available from `The Movable Python Shop <http://voidspace.tradebit.com/groups.php>`_. The cost is £5 per distribution, payment by PayPal. £1 from every distribution goes to support the development of...
31
2765
by: Mark Dufour | last post by:
Hi all, I have recently released version 0.0.20 and 0.0.21 of Shed Skin, an optimizing Python-to-C++ compiler. Shed Skin allows for translation of pure (unmodified), implicitly statically typed Python programs into optimized C++, and hence, highly optimized machine language. Besides many bug fixes and optimizations, these releases add the...
0
7888
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7811
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8159
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8185
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6571
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5366
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3811
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3836
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2317
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.