A Digital Age Deserves A Digital Leader

emacs and python

emacs and python

Postby scroll1 » Sun Apr 11, 2004 9:03 am

Thanks to Weavers advice I start my programming adventure within Python...It looks like the best starting point for me.

Now, I woulld like to edit in emacs and I have python installed on this XP box, however I can't seem to get my head around configuring emacs. I have a basic understanding of its use and I have the python-mode.el installed and I am able to run emacs in python-mode. However when I try C-c C-c on any simply script to get an output, it opens the output frame but gives me a blank screen. Have I missed a config file pointing emacs to where the python progs reside on my harddrive? I have gone through the faq at python.org...
any ideas appreciated
thanks
PRO Level 2
Posts: 10
Joined: Mon Apr 05, 2004 10:04 pm
Location: Australia

Postby Weaver » Sun Apr 11, 2004 5:25 pm

Scroll, scroll, scroll, why did you have to go and say that word... Emacs...

j/k

I am sorry I wish I could help you out, but I am a vim zealot. I have never bothered messing around with emacs, trusty vi or vim has always been available.

However, I can take a guess at your situation. I am guessing this .el file that you have installed is some sort of language pack for python, maybe it supports syntax highlighting, certain macros, etc. I am guessing that the key combination you are pressing is supposed to "run" the current file you are editing?

When you do this, you are getting a blank screen? Correct?

Have you tried saving the script and then "running" it from the command line? Does that give you zero output (I am assuming your script actually prints something to the screen) ?

You are probably right in the fact that the config is pointing to the wrong place for the Python interpreter. Try opening up the .el file (if it isn't a binary file) and see if you can locate a place where it mentions the python interpreter.

The other way that might be easier, assuming the name of the python interpreter binary is the same in Windows, is just to add the python binary to your $PATH. That may work.

-Weaver

Emacs, emacs, emacs... grrr...
Public Keys

The primary purpose of the DATA statement is to give names to constants; instead of referring to pi as 3.141592653589793 at every appearance, the variable PI can be given that value with a DATA statement and used instead of the longer form of the constant. This also simplifies modifying the program, should the value of pi change.
-- FORTRAN manual for Xerox Computers
PROfessional Member
User avatar
Posts: 1967
Joined: Wed Jun 19, 2002 12:05 am
Location: /home/weaver/

Postby scroll1 » Sun Apr 11, 2004 9:47 pm

How students can be so easily led astray....
emacs (sorry about the rude word) was my logical choice because I could use it across all my platforms (including the ipaq!)
Your assumptions on all the queries were correct, the .el file is just a script but I can't find mention of pyhton paths...I have added the path to my environments settings, but still no result.
maybe I just use IDLE or work from the command prompt. It doesn't really matter, it was an extra luxury that I thought should work.
thanks anyway,

ps... just did a quick google and found many vim editors for many different platforms... :oops: I'll try it out on the PC...

pss...I have that python book you suggested arriving soon, it seemed the best forbeginner programmers, I'll let you know how I find it.
PRO Level 2
Posts: 10
Joined: Mon Apr 05, 2004 10:04 pm
Location: Australia

Postby Weaver » Sun Apr 11, 2004 10:37 pm

Excellent on the book choice, I hope it turns out to be useful. Let me know, thanks.

I don't want to turn you into a vim zealot, but vi is available on really all Unix like platforms. That includes all flavors of Unix, Linux, and BSD (and Mac OS).

Vi is the 'VIsual editor' that was popular with original AT&T Unix guys. Later on (much later on) a guy named Bram decided to extend vi and named it vim, for "Vi IMproved." Great piece of softare. A great programmers editor, I would highly recommend learning it since it is everywhere except Windows (and ports are available).

I will warn you ahead of time it is unlike any editor you have ever used, you are going to need to read tutorials to figure out how to use it effectively. Vi [and Vim] are editors geared toward power users and they are not for the faint of heart. But... once you learn vim well you will never want to use anything else for coding.

If you try it and run into problems just ask questions.

-Weaver
Public Keys

The primary purpose of the DATA statement is to give names to constants; instead of referring to pi as 3.141592653589793 at every appearance, the variable PI can be given that value with a DATA statement and used instead of the longer form of the constant. This also simplifies modifying the program, should the value of pi change.
-- FORTRAN manual for Xerox Computers
PROfessional Member
User avatar
Posts: 1967
Joined: Wed Jun 19, 2002 12:05 am
Location: /home/weaver/

Postby scroll1 » Mon Apr 12, 2004 12:57 am

I have downloaded gvim62 onto the XP box and it loads up well, it seems to work well under XP.
I have used vi on the old Debian laptop as a simple config file editor so I know my way around the interface.
I was impressed with the emacs ability to load a command prompt into a buffer window and then to also send my simple .py files to the interpreter (which I couldn't get working), are these features available on vim?
I'll spend some time with the vim docs now at:

http://www.vim.org/

cheers and thanks again

Scroll
PRO Level 2
Posts: 10
Joined: Mon Apr 05, 2004 10:04 pm
Location: Australia

Return to HTML, CSS, and Scripts

Who is online

Users browsing this forum: No registered users and 2 guests