473,686 Members | 2,941 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 11047
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
4995
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 programs also run much slower and become extremely big compared to a normal C++ program for example. I...
1
3714
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 1.5.2 previously installed there), the installation doesn't work: Obvious problems: * IDLE...
699
33912
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 could be possible to add Pythonistic syntax to Lisp or Scheme, while keeping all of the...
28
2590
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 system If this is the reason why, than why don't developers create specific Python Distrubutions...
47
3651
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 with its syntax and simplicity. Python - just works. So please GVR. Don't complicate it. Leave it as...
114
9835
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
1417
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
4591
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 "standard" logging functionality, but we also need to insert "debug" log points in the software of...
0
1564
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 `SPE <http://pythonide.stani.be/>`_, the Python IDE.
31
2779
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 following changes: -support for 'bisect', 'collections.deque' and 'string.maketrans'
0
8581
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9050
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8766
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8778
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7598
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6439
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4307
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2205
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.