new CommaIO returns null

Hello,

I have a static method to write a txt file in a specific directory, but this method seems not working; new commaIO returns always null. The filename is correct and the directory is authorized for writing (I tried to export a project there without any problem).

Any Idea? thx

server static void writeFile(str _filename, container _data)
{

CommaIo file;
int n;
FileIoPermission perm;

;

perm = new FileIoPermission(_filename, #io_append);

perm.assert();

file = new CommaIo(_filename, #io_append);

if(!file || file.status() != IO_Status::Ok)
{
throw error(strfmt(’@SYS75767’, _filename));
}

for (n=1; n <= conLen(_data); n++)
{
file.writeExp(conPeek(_data,n));
}

CodeAccessPermission::revertAssert();

}

… this method is called from a runbasebatch class

if put in a job works without problem…

found by myself, seems the method should be client