SBU-BMI / SlicerPathology

3D Slicer extension for Pathology segmentation tools
http://bmi.stonybrookmedicine.edu
Other
5 stars 8 forks source link

runtime error: when saving zip file on Windows #80

Closed tdiprima closed 7 years ago

tdiprima commented 7 years ago

Example 1. User segments an image. Upon save, they get this message (permission denied):

zipfile name
C:\Program Files\Slicer 4.7.0-2017-05-02\TCGA-3C-AALI-01Z-00-DX1_20170503174125.zip
Traceback (most recent call last):
  File "C:/Users/tdiprima/AppData/Roaming/NA-MIC/Extensions-25996/SlicerPathology/lib/Slicer-4.7/qt-scripted-modules/SlicerPathology.py", line 326, in onSaveButtonClicked
    zf = zipfile.ZipFile(zfname, mode='w')
  File "C:\Program Files\Slicer 4.7.0-2017-05-02\lib\Python\Lib\zipfile.py", line 756, in __init__
    self.fp = open(file, modeDict[mode])
IOError: [Errno 13] Permission denied: u'C:\\Program Files\\Slicer 4.7.0-2017-05-02\\TCGA-3C-AALI-01Z-00-DX1_20170503174125.zip'

Example 2. User realizes their mistake and changes their "Data dir" to their Documents folder. Upon save, they get this output:

zipfile name:
C:/Users/tdiprima/Documents\TCGA-3C-AALI-01Z-00-DX1_20170503174148.zip
UpdateFileList: Failed to create directoryTempWriteoriginal

In the first example, the "Slicer 4.7.0-2017-05-02" directory is read-only, so the user cannot write to it (works on Linux, however).

In the second example, the slash between Documents and the zip file name is incorrect.

The second one should be easy to fix...

tdiprima commented 7 years ago

Normalizing file paths.