Lesson 0: Setting up your environment
First: Don't Panic. This tutorial is erring on the side of being more thorough. To keep things simple, the Tecplot installation installs Python 2.5.1. For Windows, we run the Python.org installation. For Linux and Mac, it's included in our installation.
Python utilizes the PYTHONPATH environment variable for setting up a list of directories where it will search for scripts. This means that if you try to run a Quick Python Script from a location not specifically contained in the PYTHONPATH list, python will not recognize it. You will receive a "Python module failed to load ... No module named ..." message.
If you're running a script just once, and you don't want to exit your Tecplot session, you can append a path for that Tecplot session. Under the Scripts menu, select Configure Python Search Path. Browse to a directory you wish to include and click Add to list.
This setting will remain until you exit Tecplot. By default, we pre-load this with a small set of directories, including the examples/python directory.
For daily use, we'd recommend setting the PYTHONPATH environment variable:
Linux:
1. Add this line to your .bashrc file:
where, obviously, /some/directory/goes/here is a colon-delimited list of directories where you want to search for scripts.
export PYTHONPATH=${PYTHONPATH}:/some/directory/goes/here
2. Source this:
. ~/.bashrc
3. Then start Tecplot. Wohoo, that was easy!
Windows:
1. Press the [Start] and [break] keys at the same time. (Alternatively, right click on your computer's icon and select "Properties"
2. Click on the Advanced tab
3. Click on the Environment Variables button
4. The "Environment Variables" dialog pops up. On the bottom half ("System Variables"), scroll down until you see PYTHONPATH. Highlight it, then click the Edit button.
Note: if you want the changes to only apply to you, or you don't have administrative rights on your desktop, use the top half of this dialog. Same variable name.
5. Our Windows installation pre-populates this with a few directories underneath the Tecplot installation directory, e.g. ?\python, ?\examples\python
Append the Variable Value field with a semi-colon and the path you wish to add. For example:
;%TEC_360_2008%\test

6. Whew!
0 TrackBacks
Listed below are links to blogs that reference this entry: Lesson 0: Setting up your environment.
TrackBack URL for this entry: http://www.tecplottalk.com/b/mt-tb.cgi/2

Leave a comment