Package edu.wisc.ssec.mcidasv.jython
Class LoadFileCommand
java.lang.Object
edu.wisc.ssec.mcidasv.jython.Command
edu.wisc.ssec.mcidasv.jython.LoadFileCommand
This class is a type of
Command
that represents a request to use
Jython to run a file containing Jython statements. This is conceptually a
bit similar to importing a module, but the loading is done behind the scenes
and you may specify whatever namespace you like (be careful!).-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLoadFileCommand
(Console console, String name, String path) Creates a command that will attempt to execute a Jython file in the namespace given byname
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
execute
(Interpreter interpreter) Tries to load the file specified bypath
usingmoduleName
for the__name__
attribute.toString()
Methods inherited from class edu.wisc.ssec.mcidasv.jython.Command
getInputStream
-
Field Details
-
name
Namespace to use when executingpath
. -
path
Path to the Jython file awaiting execution.
-
-
Constructor Details
-
LoadFileCommand
Creates a command that will attempt to execute a Jython file in the namespace given byname
.- Parameters:
console
- Originating console.name
- Namespace to use when executingpath
.path
- Path to a Jython file.
-
-
Method Details
-
execute
Tries to load the file specified bypath
usingmoduleName
for the__name__
attribute. Note that this command does not currently display any results in the originatingConsole
.If
moduleName
is not__main__
, this command is basically the same thing as doingfrom moduleName import *
.If
moduleName
is__main__
, then this command will work forif __name__ == '__main__'
and will run main functions as expected. -
toString
-