Does anyone has used the file_delete() method of SASpy? I'm trying to delete a file in SAS Server side using this method but I was unable to make it works.
sas.file_delete(filepath='/au/gac/public/data', fileref='myfile', quiet = False)
I got: AttributeError: 'SASsession' object has no attribute 'file_delete'
I just tested this. In 3.3.7 this is not available; in 3.6.6 it is available. I'm not sure exactly what version it was added in (most likely 3.5.0, that seemed to be a big update), but most likely you just need to run:
pip install saspy --upgrade
(While SASPY is not open) and it will work.
Separately, now that we have the right version, I think you may be misunderstanding the arguments to file_delete.
filepath
should not just be the folder path - it should include the filename. I don't know exactly how AIX handles these things, but the fileref
is not to tell SAS what file you want - it's actually just used in filename [fileref] [filepath];
in the actual SAS code. I'm not really sure why you'd even want this, except perhaps to later do something with that fileref.
Make sure your filepath
includes the entire directory tree plus the filename of what you want to delete.