[Tutor] Configure Problems
Wed, 15 Mar 2000 10:14:58 -0000
> I am a Newbie with Linux as well as Programming.
Welcome to the funny farm :-)
> but things are not as they supposed to be. The problems seem
> to be in configuring to use "Module Files and Script Files.
> I would really appreciate some helping hand.
You need to set two paths in your shell login files.
Your normal unix path needs to be set to include
your python project directory. This will allow you
to execute your programs from abnywhere on the system.
You need to set the PYTHONPATH environment variable
to include your directory. This will allow python
to find your modules from anyewhere on the system.
eg if you fire up the >>> prompt.
> Then chmod +x myfile.py
> could only be donw when I changed to the /home/charly/Mydir
Or if you gave the full path to your file...
> The following problem seem to occur.
> 1. To run the file at the "Shell promt" (as a shell script)
> a. I can only do it if first I cd to the files
That should be ficxed by adding your directory to the
$ env|grep PATH
to see if it has been set correctly
> b. I must also add the .py file extension
You shouldn't need to if the #! /usr/bin/python
is set correctly
> 2. If I am not in the Subdirectory /home/charly/Mydir when I
> run python (in xterm)
> import myfile
> then python gives en error.
That needs the PYTHONPATH fix.
> I was my understanding that Python would find a .py extension
> file regardless of in which directory it is.
Nope, you need to tell it.
> understanding, that if a Path is put into the
> bash_profile file the the shell would find it and it is not
You need to add it to the PATH variable,
I assume - I use tcsh myself!