Page 1 of 1

kmz creates temporary directory

Posted: Tue Oct 09, 2018 3:48 pm
by joleenf

I am saving files as kmz files using the scripting API. I noticed that this seems to be creating temporary directories in my McIDAS-V home directory <HOME>/McIDAS-V/tmp.

When I save through the GUI, I am seeing png files being placed in the temporary directory. These are filling up a /home directory on a shared machine because I am generating kmz files for the web.

(I forgot to update McV, so I am currently using the 2018-09-10 build on my Mac and Linux box.).


Re: kmz creates temporary directory

Posted: Tue Oct 09, 2018 7:57 pm
by bobc
Hi Joleen,

Thanks for bringing this to our attention. I'm replicating that these directories in the McIDAS-V/tmp directory aren't being cleared out. I wrote up Inquiry 2726 to investigate a better way of cleaning this /tmp directory. In the meantime, I wrote up the following script:

Code: Select all

# get path to McIDAS-V/tmp directory
tmpDir = '%s/tmp' % os.environ['MCV_USERPATH']
# get a listing of files
inDir = os.listdir(tmpDir)

# set up empty list for files/dirs
tmpList = []

# loop through files/dirs in tmpDir directory and add
# only those beginning with 'tmpdir' to tmpList above
for x in inDir:
    if str(x[0:6]) == 'tmpdir':

# notify user of directories being removed:
print 'Removing directories:'
for x in tmpList:
    print x

# loop through items in tmpList list and remove them
# shutil.rmtree is used to remove directory and contents
for x in tmpList:
    shutil.rmtree('%s/%s' % (tmpDir, x))

There are comments throughout, but basically this script removes anything in your McIDAS-V/tmp directory whose first six characters are "tmpdir", which is what these directories are called on my Windows 7 machine. Until Inquiry 2726 is investigated, perhaps you could add something like the above lines to your scripts to clean the /tmp directory? If this doesn't seem like a reasonable workaround, please let me know.


Re: kmz creates temporary directory

Posted: Wed Oct 10, 2018 1:39 pm
by joleenf

I am pretty sure I can work with you solution until the inquiry is addressed.