jigneshvasoya / ruffus

Automatically exported from code.google.com/p/ruffus
MIT License
0 stars 0 forks source link

@mkdir results in an Uncaught (fatal) exception if the directory already exists #69

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Sean Turley says:
while testing the regex mkdir example from the documentation:

http://www.ruffus.org.uk/tutorials/new_tutorial/mkdir_code.html#new-manual-mkdir
-code

Traceback (most recent call last):
  File "C:/Users/spt5007/PycharmProjects/RuffusExp/MkdirBroken.py", line 39, in <module>
    pipeline_run(verbose=0)
  File "C:\Python27\lib\site-packages\ruffus\task.py", line 3767, in pipeline_run
    raise job_errors
ruffus.ruffus_exceptions.RethrownJobError: 

Original exception:

    Exception #1
      'exceptions.WindowsError([Error 183] Cannot create a file when that file already exists: 'mammals')' raised in ...
       Task = __main__.(mkdir 1) before __main__.feed
       Make directories mammals

    Traceback (most recent call last):
      File "C:\Python27\lib\site-packages\ruffus\task.py", line 685, in run_pooled_job_without_exceptions
        return_value =  job_wrapper(param, user_defined_work_func, register_cleanup, touch_files_only)
      File "C:\Python27\lib\site-packages\ruffus\task.py", line 581, in job_wrapper_mkdir
        os.makedirs(d)
      File "C:\Python27\lib\os.py", line 157, in makedirs
        mkdir(name, mode)
    WindowsError: [Error 183] Cannot create a file when that file already exists: 'mammals'

Process finished with exit code 1

Original issue reported on code.google.com by bunbu...@gmail.com on 10 Jul 2014 at 1:33

GoogleCodeExporter commented 9 years ago
This seems to be a Windows specific problem. task.py:job_wrapper_mkdir() calls 
os.makedirs(d) and ignore OSError exceptions if the text includes the words 
"File exists". Unfortunately, in Windows, the exception is WindowsError and the 
message should include "file already exists". A patch has been submitted and 
will be incorporated into Ruffus v.2.4.2

Original comment by bunbu...@gmail.com on 10 Jul 2014 at 1:35