CINPLA / expipe-plugin-cinpla

Plugins for expipe command line interface
http://expipe-plugin-cinpla.readthedocs.io/en/latest/
GNU General Public License v3.0
1 stars 3 forks source link

Windows/IronClust os.remove #28

Closed espenhgn closed 5 years ago

espenhgn commented 5 years ago

@alejoe91 , as we discussed: os.remove during cleanup doesn't work on windows due to some permission error

espenhgn commented 5 years ago

Hi @alejoe91 ; checked now your os.remove fix, and it does not work on Windows (tested with dev branch SHA 19efc4c ):

Found  3  units!
Computing waveforms
Waveforms by property:  group
Waveform 1/3
Waveform 2/3
Waveform 3/3
Saving sorting output to exdir format
Single group:  0
Saving eventwaveforms and clustering
Saving LFP to exdir format
Loading Open-Ephys: reading settings.xml...
Decoding data from  binary  format
Tracking is not found!
Cleanup
Traceback (most recent call last):
  File "C:\Users\malinbro\AppData\Local\Continuum\anaconda3\Scripts\expipe-script.py", line 11, in <
module>
    load_entry_point('expipe-cli', 'console_scripts', 'expipe')()
  File "c:\users\malinbro\appdata\local\continuum\anaconda3\lib\site-packages\click\core.py", line 7
22, in __call__
    return self.main(*args, **kwargs)
  File "c:\users\malinbro\appdata\local\continuum\anaconda3\lib\site-packages\click\core.py", line 6
97, in main
    rv = self.invoke(ctx)
  File "c:\users\malinbro\appdata\local\continuum\anaconda3\lib\site-packages\click\core.py", line 1
066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\malinbro\appdata\local\continuum\anaconda3\lib\site-packages\click\core.py", line 1
066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\malinbro\appdata\local\continuum\anaconda3\lib\site-packages\click\core.py", line 8
95, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\users\malinbro\appdata\local\continuum\anaconda3\lib\site-packages\click\core.py", line 5
35, in invoke
    return callback(*args, **kwargs)
  File "c:\apps\expipe-plugin-cinpla\expipe_plugin_cinpla\cli\openephys.py", line 98, in _process_op
enephys
    openephys.process_openephys(PAR.PROJECT, action_id, probe_path, sorter)
  File "c:\apps\expipe-plugin-cinpla\expipe_plugin_cinpla\scripts\openephys.py", line 177, in proces
s_openephys
    if not os.access(tmpdir, os.W_OK):
TypeError: access: illegal type for path parameter

(base) c:\apps\COBRA_actions>
alejoe91 commented 5 years ago

Seems to be working now adding:

if not os.access(str(tmpdir), os.W_OK):
    # Is the error an access error ?
    os.chmod(str(tmpdir), stat.S_IWUSR)
shutil.rmtree(str(tmpdir), ignore_errors=True)