CommaIO Object not initialized Stack trace error

CommaIO object not initialized error giving while creating csv file.

It is working on job perfectly.when coming to the class it’s giving error.

Here,file location is network location.Any problem with permissions.

My code.

static void Job29(Args _args)
{

CommaIo file;

FileIOPermission fileIOPemission;

str filename;

filename =@’\uslsv\testing\test.csv’;

fileIOPemission = new FileIOPermission(filename,‘W’);

fileIOPemission.assert(fileIOPemission);

file = new CommaIO(filename,‘W’);

file.write(‘test’);

file = null;

CodeAccessPermission:revertAssert();

}

Thanks.

Hi Vijay,

try following…

#File
CommaIo file;
FileIOPermission fileIOPemission;
str filename;

filename = @‘c:\test.csv’;

fileIOPemission = new FileIOPermission(filename,#io_write);
fileIOPemission.assert();

file = new CommaIO(filename,#io_write);
file.outFieldDelimiter(’,’);// for semicolon separator

if (!file || file.status() != IO_Status::Ok)
{
throw error(“File cannot be opened.”);
}

file.write(‘test’);

CodeAccessPermission::revertAssert();

Thanks,

Make sure that AOS service account has permissions to create a file there.

Vijay,

Please check if that path is accessible by the user /AOS service account

Thank you