Lesson 0: Setting up your environment

| | Comments (0) | TrackBacks (0)
config_python_search_path.jpgFirst: 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:

export PYTHONPATH=${PYTHONPATH}:/some/directory/goes/here

where, obviously, /some/directory/goes/here is a colon-delimited list of directories where you want to search for scripts.
 
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"
system_properties.jpg
 







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.

windows_environment_variables.jpg




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

edit_system_variable.jpg











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

About this Entry

This page contains a single entry by jim published on January 14, 2008 7:49 AM.

Python on Tecplot: resources was the previous entry in this blog.

Lesson 1: Hello World is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 4.01