SCIRun User Mailing List

Text archives Help

Re: [SCIRUN-USERS] Help with "InterfaceWithPython"

Chronological Thread 
  • From: jess <>
  • To: Douglas Todd <>
  • Cc:
  • Subject: Re: [SCIRUN-USERS] Help with "InterfaceWithPython"
  • Date: Fri, 17 Apr 2020 13:02:39 -0600

Hi Douglas,

The documentation for the SCIRun Python API, including the interfaceWithPython module, is found:

It looks like in your example, you may be missing an input assignment.  You will probably need something like
`Field = inputField1`
at the beginning of your script.  Make sure that it matches the name in the input tab. If this name is Field, it helps to have the fields assigned to a separate variable before you call entries in the dictionary, which is a line similar to the one above.  Perhaps that is something we can fix. 


On Mar 26, 2020, at 3:22 PM, Douglas Todd <> wrote:

I am currently running Version 5.0-beta.X+ Qt5.14.1 on Linux and am having difficulty with "InterfaceWithPython". I have used the example given under the "Help" menu under "Python Wizard". Below is the error messages. Attached is a picture of the python errors. It appears that the error is on line 20 of the script, where the "Field" variable is being assigned to fieldOutput. The python shown is from the "Python Wizard" Additionally, Could you point me to the documentation for this interface? It appears that "Field" is a dictionary. What are the entries? Is a description available?

As always, thank you for your help.

Douglas Todd


This module allows you to take an input (String, Matrix, or Field) and perform Python-based algorithms on the input code. The module UI allows you to name each of the inputs and outputs which can then be referenced in the pasted code block.

Detailed Description

A detailed description of this module is not available at this time. For assistance please contact

The code as it appears in the "InterfaceWithPython" dialog box:

Nodes = Field["node"]
new_nodes = []

for n in Nodes:
nn = [[]]*3

if n[0]>0:
nn[0] = n[0]

nn[0] = n[0]/2

nn[1] = n[1]
nn[2] = n[2]


Field["node"] = new_nodes

fieldOutput1 = Field

Error messages from the screen.

[PYTHON ERROR]   File "/opt/SciRun/SCIRun-5.0-beta.X/bin/SCIRun/lib/python3.5/", line 168, in __call__ [PYTHON ERROR]     [PYTHON ERROR] return _maybe_compile(self.compiler, source, filename, symbol) [PYTHON ERROR] [PYTHON ERROR]   File "/opt/SciRun/SCIRun-5.0-beta.X/bin/SCIRun/lib/python3.5/", line 99, in _maybe_compile [PYTHON ERROR]     [PYTHON ERROR] raise err1 [PYTHON ERROR] [PYTHON ERROR]   File "/opt/SciRun/SCIRun-5.0-beta.X/bin/SCIRun/lib/python3.5/", line 87, in _maybe_compile [PYTHON ERROR]     [PYTHON ERROR] code1 = compiler(source + "\n", filename, symbol) [PYTHON ERROR] [PYTHON ERROR]   File "/opt/SciRun/SCIRun-5.0-beta.X/bin/SCIRun/lib/python3.5/", line 133, in __call__ [PYTHON ERROR]     [PYTHON ERROR] codeob = compile(source, filename, symbol, self.flags, 1) [PYTHON ERROR] [PYTHON ERROR]   File "<script>", line 20 [PYTHON ERROR]     [PYTHON ERROR] scirun_set_module_transient_state("InterfaceWithPython:0","scirun_get_module_input_value("InterfaceWithPython:0", "InputField:0")Output1",Field)


[PYTHON ERROR]  [PYTHON ERROR]  [PYTHON ERROR]  [PYTHON ERROR] ^ [PYTHON ERROR] SyntaxError [PYTHON ERROR] : [PYTHON ERROR] invalid syntax [PYTHON ERROR] [2020-03-26 14:01:31.423] [module] [error] [ExtractIsosurface:0] Input data required on port InputField QObject::connect: Cannot queue arguments of type 'QTextCursor' (Make sure 'QTextCursor' is registered using qRegisterMetaType().) [2020-03-26 14:01:31.424] [module] [error] [ShowField:0] Input data required on port Field

SCIRun users mailing list:
To unsubscribe, email with the "unsubscribe scirun-users" in the message body.

  • Re: [SCIRUN-USERS] Help with "InterfaceWithPython", jess, 04/17/2020

Archive powered by MHonArc 2.6.18.

Top of page