NameError:未定义名称“ MemoryStream”

时间:2019-06-20 22:12:05

标签: .net ironpython spotfire

我收到“ NameError:名称'MemoryStream'未定义”。我想念什么吗?

我的代码从这里开始:

from System.IO import Path, File, StreamWriter

from Spotfire.Dxp.Application.Visuals import VisualContent

import System.IO

vc=Visuals.As[VisualContent]() 

memStream = MemoryStream();

sWriter = StreamWriter(memStream);

vc.ExportText(sWriter); 

sReader = StreamReader(memStream);

memStream.Seek(0, SeekOrigin.Begin);

filename="C:\Users\Documents\TEST.csv"

f=open(filename,"w")

counter=0

j=0

str1=''

while (sReader.Peek()>=0):

    line=[]

    counter=counter+1 

    a=sReader.ReadLine()

    lines=a.split("\t")

    for elem in lines:

        j=j+1 

        print elem

        if str(elem).find(",")<>-1:

            elem='"'+elem+'"' 

        line.append(elem)

    str1 = ','.join(str(e) for e in line)

    f.write(str1+'\n')

f.close();

sReader.Close()

Visuals =用于表/跨表可视化的脚本参数

将数据导出到Memory Stream并以逗号分隔的文本导出数据

0 个答案:

没有答案