Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Can I run a python program from within emacs?

Reply
Thread Tools

Can I run a python program from within emacs?

 
 
jmDesktop
Guest
Posts: n/a
 
      03-20-2008
Hi, I'm trying to learn Python. I using Aquamac an emac
implementation with mac os x. I have a program. If I go to the
command prompt and type pythong myprog.py, it works. Can the program
be run from within the editor or is that not how development is done?
I ask because I was using Visual Studio with C# and, if you're
familiar, you just hit run and it works. On Python do I use the
editor for editing only and then run the program from the command
line? Thank you.
 
Reply With Quote
 
 
 
 
Grant Edwards
Guest
Posts: n/a
 
      03-20-2008
On 2008-03-20, jmDesktop <(E-Mail Removed)> wrote:

> Hi, I'm trying to learn Python. I using Aquamac an emac
> implementation with mac os x. I have a program. If I go to the
> command prompt and type pythong myprog.py, it works. Can the program
> be run from within the editor or is that not how development is done?
> I ask because I was using Visual Studio with C# and, if you're
> familiar, you just hit run and it works. On Python do I use the
> editor for editing only and then run the program from the command
> line?


http://www.google.com/search?q=emacs+python

--
Grant

 
Reply With Quote
 
 
 
 
Jeff Schwab
Guest
Posts: n/a
 
      03-20-2008
Grant Edwards wrote:
> On 2008-03-20, jmDesktop <(E-Mail Removed)> wrote:
>
>> Hi, I'm trying to learn Python. I using Aquamac an emac
>> implementation with mac os x. I have a program. If I go to the
>> command prompt and type pythong myprog.py, it works. Can the program
>> be run from within the editor or is that not how development is done?
>> I ask because I was using Visual Studio with C# and, if you're
>> familiar, you just hit run and it works. On Python do I use the
>> editor for editing only and then run the program from the command
>> line?

>
> http://www.google.com/search?q=emacs+python


Or achieve a similar (more flexible (IMO), but less smoothly integrated)
effect with Vim and GNU Screen. Until recently, you had to patch Screen
if you wanted vertical splits, but now it's in the main line.
 
Reply With Quote
 
jmDesktop
Guest
Posts: n/a
 
      03-20-2008
On Mar 20, 11:21*am, Grant Edwards <(E-Mail Removed)> wrote:
> On 2008-03-20, jmDesktop <(E-Mail Removed)> wrote:
>
> > Hi, I'm trying to learn Python. *I using Aquamac an emac
> > implementation with mac os x. *I have a program. *If I go to the
> > command prompt and type pythong myprog.py, it works. *Can the program
> > be run from within the editor or is that not how development is done?
> > I ask because I was using Visual Studio with C# and, if you're
> > familiar, you just hit run and it works. *On Python do I use the
> > editor for editing only and then run the program from the command
> > line?

>
> http://www.google.com/search?q=emacs+python
>
> --
> Grant


Gee. Thanks.
 
Reply With Quote
 
Jeff Schwab
Guest
Posts: n/a
 
      03-20-2008
jmDesktop wrote:
> On Mar 20, 11:21 am, Grant Edwards <(E-Mail Removed)> wrote:
>> On 2008-03-20, jmDesktop <(E-Mail Removed)> wrote:
>>
>>> Hi, I'm trying to learn Python. I using Aquamac an emac
>>> implementation with mac os x. I have a program. If I go to the
>>> command prompt and type pythong myprog.py, it works. Can the program
>>> be run from within the editor or is that not how development is done?
>>> I ask because I was using Visual Studio with C# and, if you're
>>> familiar, you just hit run and it works. On Python do I use the
>>> editor for editing only and then run the program from the command
>>> line?


Sort of. Modern editors generally have support for building and running
your program directly from a toolbar button or textual command. I
personally use Vim with the toolbar disabled, running in a Terminal, and
run the program by first putting Vim in the background (^z).

People writing code specific to Mac, but not necessarily all in Python,
often use XCode.

http://zovirl.com/2006/07/13/xcode-python/

In the Ruby community, Vim is the dominant choice, but a lot of Mac
users swear by TextMate.

http://macromates.com/

>> http://www.google.com/search?q=emacs+python


> Gee. Thanks.


I believe Grant was suggesting that Emacs often serves a similar purpose
on Unix to what Visual Studio does on Windows, which seemed to be what
you were asking. When asking about Mac OS X here, you are likely to get
a lot of generic Unix responses. (Would it have been clearer if he had
just said "emacs?")
 
Reply With Quote
 
Paulo da Costa
Guest
Posts: n/a
 
      03-20-2008
Jeff Schwab wrote:
> jmDesktop wrote:
>> On Mar 20, 11:21 am, Grant Edwards <(E-Mail Removed)> wrote:
>>> On 2008-03-20, jmDesktop <(E-Mail Removed)> wrote:
>>>
>>>> Hi, I'm trying to learn Python. I using Aquamac an emac
>>>> implementation with mac os x. I have a program. If I go to the
>>>> command prompt and type pythong myprog.py, it works. Can the program
>>>> be run from within the editor or is that not how development is done?
>>>> I ask because I was using Visual Studio with C# and, if you're
>>>> familiar, you just hit run and it works. On Python do I use the
>>>> editor for editing only and then run the program from the command
>>>> line?

>
> Sort of. Modern editors generally have support for building and running
> your program directly from a toolbar button or textual command. I
> personally use Vim with the toolbar disabled, running in a Terminal, and
> run the program by first putting Vim in the background (^z).


Modern editors like GNU Emacs show you a Python tab when you're editing
a Python file that allows you to do various things with the code, just
like Visual Studio, I don't know about "Aquamacs".

> I believe Grant was suggesting that Emacs often serves a similar purpose
> on Unix to what Visual Studio does on Windows, which seemed to be what
> you were asking. When asking about Mac OS X here, you are likely to get
> a lot of generic Unix responses. (Would it have been clearer if he had
> just said "emacs?")


There are several flavors, it's best to specify which one you mean.
People who say Emacs often mean GNU Emacs.

Paulo
 
Reply With Quote
 
jmDesktop
Guest
Posts: n/a
 
      03-20-2008
On Mar 20, 11:44*am, Jeff Schwab <(E-Mail Removed)> wrote:
> jmDesktop wrote:
> > On Mar 20, 11:21 am, Grant Edwards <(E-Mail Removed)> wrote:
> >> On 2008-03-20, jmDesktop <(E-Mail Removed)> wrote:

>
> >>> Hi, I'm trying to learn Python. *I using Aquamac an emac
> >>> implementation with mac os x. *I have a program. *If I go to the
> >>> command prompt and type pythong myprog.py, it works. *Can the program
> >>> be run from within the editor or is that not how development is done?
> >>> I ask because I was using Visual Studio with C# and, if you're
> >>> familiar, you just hit run and it works. *On Python do I use the
> >>> editor for editing only and then run the program from the command
> >>> line?

>
> Sort of. *Modern editors generally have support for building and running
> your program directly from a toolbar button or textual command. *I
> personally use Vim with the toolbar disabled, running in a Terminal, and
> run the program by first putting Vim in the background (^z).
>
> People writing code specific to Mac, but not necessarily all in Python,
> often use XCode.
>
> * * *http://zovirl.com/2006/07/13/xcode-python/
>
> In the Ruby community, Vim is the dominant choice, but a lot of Mac
> users swear by TextMate.
>
> * * *http://macromates.com/
>
> >>http://www.google.com/search?q=emacs+python

> > Gee. *Thanks.

>
> I believe Grant was suggesting that Emacs often serves a similar purpose
> on Unix to what Visual Studio does on Windows, which seemed to be what
> you were asking. *When asking about Mac OS X here, you are likely to get
> a lot of generic Unix responses. *(Would it have been clearer if he had
> just said "emacs?")


No. Typically when someone posts a one-liner search it means go
figure it out and stop bothering "us." I had already searched. I
could not get it to work, which is why I posted. If I took it wrong I
apologize.

I really had two questions. One is just how to run a program from
within the editor and the other is if my thinking on how development
is done in python wrong to start with. Most of my non-Windows
programs have been on Unix using vi, but it has been a while. I'm
used to writing a program in visual studio and running it. If that's
the wrong expectation for python programming in emacs, then I wanted
to know.

Thanks for your help.
 
Reply With Quote
 
Grant Edwards
Guest
Posts: n/a
 
      03-20-2008
On 2008-03-20, jmDesktop <(E-Mail Removed)> wrote:
> On Mar 20, 11:21*am, Grant Edwards <(E-Mail Removed)> wrote:
>> On 2008-03-20, jmDesktop <(E-Mail Removed)> wrote:
>>
>> > Hi, I'm trying to learn Python. *I using Aquamac an emac
>> > implementation with mac os x. *I have a program. *If I go to the
>> > command prompt and type pythong myprog.py, it works. *Can the program
>> > be run from within the editor or is that not how development is done?
>> > I ask because I was using Visual Studio with C# and, if you're
>> > familiar, you just hit run and it works. *On Python do I use the
>> > editor for editing only and then run the program from the command
>> > line?

>>
>> http://www.google.com/search?q=emacs+python

>
> Gee. Thanks.


Golly. You're welcome. Don't the hits on the first page
answer your question? They explain how to do things like run
python programs from within emacs (including how to do
source-level debugging).

This is probably one of the better pages that the google search
above found:

http://wiki.python.org/moin/EmacsEditor

--
Grant
 
Reply With Quote
 
Grant Edwards
Guest
Posts: n/a
 
      03-20-2008
On 2008-03-20, Jeff Schwab <(E-Mail Removed)> wrote:

>>> http://www.google.com/search?q=emacs+python

>
>> Gee. Thanks.

>
> I believe Grant was suggesting that Emacs often serves a similar purpose
> on Unix to what Visual Studio does on Windows, which seemed to be what
> you were asking. When asking about Mac OS X here, you are likely to get
> a lot of generic Unix responses. (Would it have been clearer if he had
> just said "emacs?")


Don't the normal "run/debug python from inside emacs" methods
work on OS-X?

--
Grant

 
Reply With Quote
 
Grant Edwards
Guest
Posts: n/a
 
      03-20-2008
On 2008-03-20, jmDesktop <(E-Mail Removed)> wrote:

>> I believe Grant was suggesting that Emacs often serves a
>> similar purpose on Unix to what Visual Studio does on Windows,
>> which seemed to be what you were asking. *When asking about
>> Mac OS X here, you are likely to get a lot of generic Unix
>> responses. *(Would it have been clearer if he had just said
>> "emacs?")

>
> No. Typically when someone posts a one-liner search it means
> go figure it out and stop bothering "us." I had already
> searched. I could not get it to work,


Could not get what to work?

> which is why I posted. If I took it wrong I apologize.


I honestly thought you were asking how to run/debug python
programs inside emacs. A couple of the hits answered that
question. The others explained how do get python-aware editing
modes configured.

> I really had two questions. One is just how to run a program from
> within the editor and the other is if my thinking on how development
> is done in python wrong to start with. Most of my non-Windows
> programs have been on Unix using vi, but it has been a while. I'm
> used to writing a program in visual studio and running it.


Perhaps you'd be more comfortable with one of the IDEs?

http://wiki.python.org/moin/Integrat...ntEnvironments
http://en.wikipedia.org/wiki/Compari...onments#Python

> If that's the wrong expectation for python programming in
> emacs, then I wanted to know.


Yes, you can run programs (including python debuggers) from
inside emacs. The simplest way is to do "meta-x shell" to get
a shell prompt inside emacs, then just type whatever command
line you want to use to run the program. Or you can map a
command to a keystroke that will run the program.

I generally just have another terminal window open where I run
the program -- but I've never liked IDEs so your tastes may
differ.

--
Grant
 
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
Can I run a python program from within emacs? Robinson Python 2 11-03-2009 09:58 PM
Re: Can I run a python program from within emacs? Robinson Python 0 11-01-2009 05:16 PM
Run program from within Python frankrentef Python 3 08-06-2008 08:18 PM
How to get inputs for a python program that run from another python program pradeep nair Python 2 06-12-2007 01:20 PM
Can Java program evoke and run a FORTRAN program directly? Shawn Java 2 12-06-2006 07:08 PM



Advertisments