‹‹ Back to SVS Home

The Python Shell Window

6.2 The Python Shell Window

To open the Python shell window, select the Tools > Open Python Shell from the either the Welcome screen or the main Project Navigator Window.

A Python shell can be executed with or without an open project. The Python shell window has several buttons on a tool bar, which are from left to right:

  • Reset the Shell: Erase the command history and clear the text on the shell window.
  • Give Feedback: Opens a menu for emailing feedback to Golden Helix, Inc., Inc. to report a bug, request a feature, or share your experience.
  • Show Project Viewer: Brings the Project Navigator Window to the front.
  • Python Shell Help: Opens the SVS Manual to the chapter on scripting.

It may be useful when developing a script to experiment interactively in the SVS shell.

Using Shell Objects

While describing the Python Shell, there will be some terms used repeatedly. Object is one of them. “Object” refers to a named shell item representing some data and has methods associated with it. Different scripting commands will create objects with access to object specific methods. When the Python Shell is started one object is always created and present. This is the ghi object. Every object will have methods associated with it to perform specific tasks. Methods are accessed using the object name followed by a period then the method name and any parameters in parentheses. For example: ghi.getObject(3). Sometimes a method will change the state of an object’s data, and other times a method may create a new object.

Using the Directory Command

At any time the dir() command can be used to see all of the objects currently available. This command produces a listing of all the current objects in the shell. One of the objects in the shell is the ghi object. To see the methods available for the ghi object,use the dir command again–only this time put ghi in the parentheses; dir(ghi). When an object’s name is used as a parameter in the dir command, a listing of all the methods that the object contains will be provided.

Getting Help on a Python Command

Detailed descriptions of the scripting commands provided by SVS are found in the section Scripting Reference. A brief form of help is also available from within the Python Shell by using the help() command. Using this command with the name of an object in the parentheses displays a help message for the object, such as: help(objectName). Help is also available for any method of an object by typing help(objectName.methodName). For example, in the ghi object there are several methods including openProject, newProject, and importData. To get help on importData, type help(ghi.importData) at the Python shell prompt.