Python is easy?

Christopher chris_mk at hotmail.com
Wed Aug 14 14:03:18 EDT 2002


Hi,

First of all, I would recommend you look at Peter Hansen's response
first.  It should get you working, if not you can look at the end of
this post to see what I have to say.  Other than that, I have a few
more comments on the ease of use of a couple different languages.

I'm only posting this because there seems to be a difficulty with
getting Python to work on your computer.  Whether that is due to a
faulty configuration, mistaken PATH and PYTHONPATH settings, or
something else will be determined.  However, I don't want you to think
that 1) this difficulty is common (in my, albeit limited, experience,
this is not the norm) or 2) that Python is a difficult language to
work with.

Having said that, I have a few things to say.  I start off a few years
ago when I decided to learn C++.  I was sick of trying to find
programs that I could get to do what I wanted so I figured I would
start learning to make my own.  I picked C++ because, after some
research, it was 1) one of the most robust and powerful languages and
2) it was one of the most difficult to learn.  I figured that if I
started with anything easier (say VB), I may not ever have the
motivation to learn C++ (okay, I'm not saying anything about VB, just
repeating what my research led me to believe ;-) ).  Learned that,
started to learn MFC then decided that I really, REALLY didn't want
to.  So I moved on to Java (Java was all the rage and most people I
spoke to didn't know much about Python, which I heard most about on
Bruce Eckel's page <http://www.mindview.net/Books/Python/ThinkingInPython.html>.
 Then I read a sample chapter of Developing Bioinformatics Computer
Skills <http://bio.oreilly.com> and they mentioned one should be
proficient in a system language (C++ or Java) and a scripting language
(Perl or Python).  Well, everybody and their mother knew some Perl,
even me (plus it looked really ugly) so I decided to be the odd man
out and use Python.  Let me say, Python has the absolute best ratio of
power to simplicity that I have ever found.  There's not much I prefer
to use C++ for (esp. now that I am using Numeric and some other
third-party modules) but I can code in C++ and still use Python.  In
fact, I really consider it a disservice to call Python a scripting
language.  I think that maybe the simplicity of use makes those
unfamiliar with the language classify it there.  Now, I use it as much
as possible, however (and I think this is an important point), I never
use it when it would be simpler/more efficient to use C++ or Java (or
even Perl, which I am learning since most of the computer guys at work
use it and I need to be able to relate).

Having said that, here is what I recommend you do to run your script. 
Open a console (I am assuming you have a Wintel system).  cd to the
directory containing your test1 module.  Then type in your full
python.exe path then your full module name (on my Wintel it is,
C:\Python22\python.exe test1.py).  That should work no matter your
PATH or PYTHONPATH settings.  If python is installed and your module
is correct, it can't NOT work.  Alternatively, cd to the directory
where your test module is, then type in the full path to the python
exe and call the python exe (C:\Python22\python.exe).  Then you will
be greeted with the good ole interactive prompt:
>>> 

then import your module (do NOT include the .py extension while you
are in the interactive mode).

>>> import test1

run some stuff then hit CTRL-Z to exit.

Here is an example if the test module is in C:\MyPython\TestMods and
is called Example_Test.py (and my python.exe is in C:\Python22

C:\>cd C:\MyPython\TestMods
C:\MyPython\TestMods>C:\Python22\python.exe Example_Test.py
<results here>

or

C:\>cd C:\MyPython\TestMods
C:\MyPython\TestMods>C:\Python22\python.exe
<python info printed>
>>> import Example_Test
<results from module>
>>> ^Z

C:\MyPython\TestMods>


Have fun,

Chris

jdriller at orchid.org (Jonathan Driller) wrote in message news:<a8cff9fb.0208131748.125ee112 at posting.google.com>...
> Steve,
> Much thanks and I agree with your first comment. Possibly something
> else is going on - what you suggested did not work. But if I open the
> Python command line I can do things like >>>3 + 3   >>>6 - so Python
> is working. Any other ideas?
> 
> Jonathan



More information about the Python-list mailing list