Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/331.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
python程序中出现错误,可能与vtk有关。请帮忙?_Python_Vtk - Fatal编程技术网

python程序中出现错误,可能与vtk有关。请帮忙?

python程序中出现错误,可能与vtk有关。请帮忙?,python,vtk,Python,Vtk,我对python非常陌生,我正在运行这个程序,它给了我以下错误: ERROR: In /builddir/build/BUILD/VTK6.0.0/Common/ExecutionModel/vtkDemandDrivenPipeline.cxx, line 715 vtkCompositeDataPipeline (0x2987f40): Input port 0 of algorithm vtkXMLStructuredGridWriter(0x2985d30) has 0 connecti

我对python非常陌生,我正在运行这个程序,它给了我以下错误:

ERROR: In /builddir/build/BUILD/VTK6.0.0/Common/ExecutionModel/vtkDemandDrivenPipeline.cxx, line 715
vtkCompositeDataPipeline (0x2987f40): Input port 0 of algorithm vtkXMLStructuredGridWriter(0x2985d30) has 0 connections but is not optional.
这是完整的回溯

Traceback (most recent call last):
  File "bvts.py", line 65, in <module>
    writer.SetInput(grid)
AttributeError: SetInput

VTK6上的SetInput方法已被替换,请参见

您应该尝试以下操作,而不是SetInput:

writer->SetInputConnection(grid->GetProducerPort());

代码正在编译并生成正确的结果。请发布您的完整回溯。@Nanashi我不确定它是什么(我没有真正用Python编写任何程序,我正在为一个我应该做的项目学习这个程序),但这是您问的吗?回溯(最后一次调用):writer.SetInput(grid)AttributeError:SetInputYes中第65行的文件“bvts.py”,请编辑您的OP并将其发布在那里,以提高可读性和文档质量。非常感谢@Nanashi:)谢谢您的编辑。您能告诉我您的Python和
vtk
版本是什么吗?对于Python,只需在命令行中键入
Python
(我相信您使用的是UNIX类型的机器),然后告诉我之后显示的数字。对于
vtk
,请键入
import vtk
,按return,然后
print vtk.\uuuu版本\uuuu
。或者,如果出现错误,请返回命令行(不在Python中),并输入
pipfreeze
。查找
VTK==x.x.x
。例如,我的是
VTK=5.10.1
。谢谢,这一行没有用,但是链接非常有用。我找到了修理它的线!
writer->SetInputConnection(grid->GetProducerPort());