edickie / ciftify

The tools of the Human Connectome Project (HCP) adapted for working with non-HCP datasets
https://edickie.github.io/ciftify/
MIT License
111 stars 156 forks source link

File exists error #59

Closed wangboc closed 6 years ago

wangboc commented 6 years ago

Hi, when I run ciftify_recon_all script in the newest version, some errors appear. By checking the path, I find two MNINonLinear folds generated.

/root/projects/ciftify/ciftify/output/sub-50005/T1w/Native /tmp/tmpzrV5el/T1w/native /root/projects/ciftify/ciftify/output/sub-50005/MNINonLinear/Native /tmp/tmpzrV5el/MNINonLinear/native _/root/projects/ciftify/ciftify/output/sub-50005/MNINonLinear_

Traceback (most recent call last): File "/usr/local/bin/ciftify_recon_all", line 11, in load_entry_point('ciftify==2.0.2', 'console_scripts', 'ciftify_recon_all')() File "/usr/local/lib/python2.7/site-packages/ciftify-2.0.2-py2.7.egg/ciftify/bin/ciftify_recon_all.py", line 1436, in main run_ciftify_recon_all(tmpdir, settings) File "/usr/local/lib/python2.7/site-packages/ciftify-2.0.2-py2.7.egg/ciftify/bin/ciftify_recon_all.py", line 106, in run_ciftify_recon_all os.path.join(subject.atlas_space_dir, 'Results')) File "/usr/local/lib/python2.7/site-packages/ciftify-2.0.2-py2.7.egg/ciftify/bin/ciftify_recon_all.py", line 400, in create_output_directories ciftify.utils.make_dir(mesh['Folder'], DRYRUN, suppress_exists_error = True) File "/usr/local/lib/python2.7/site-packages/ciftify-2.0.2-py2.7.egg/ciftify/utils.py", line 73, in make_dir os.makedirs(dir_name) File "/usr/local/lib/python2.7/os.py", line 157, in makedirs mkdir(name, mode) OSError: [Errno 17] File exists: '/root/projects/ciftify/ciftify/output/sub-50005/MNINonLinear'

=================================================================================

I find some clues in ciftify_recon_all.py in line 398, create_output_directories function. The meshes.values include the following information: {'ROI': 'roi', 'meshname': 'native', 'T2wImage': '/root/projects/ciftify/ciftify/output/sub-50005/T1w/T2w.nii.gz', 'DenseMapsFolder': '/root/projects/ciftify/ciftify/output/sub-50005/MNINonLinear/Native', 'T1wImage': '/root/projects/ciftify/ciftify/output/sub-50005/T1w/T1w.nii.gz', 'Folder': '/root/projects/ciftify/ciftify/output/sub-50005/T1w/Native', 'tmpdir': '/tmp/tmps9u7P2/T1w/native'}

{'ROI': 'roi', 'meshname': 'native', 'T2wImage': '/root/projects/ciftify/ciftify/output/sub-50005/MNINonLinear/T2w.nii.gz', 'T1wImage': '/root/projects/ciftify/ciftify/output/sub-50005/MNINonLinear/T1w.nii.gz', 'Folder': '/root/projects/ciftify/ciftify/output/sub-50005/MNINonLinear/Native', 'tmpdir': '/tmp/tmps9u7P2/MNINonLinear/native'}

{'ROI': 'atlasroi', 'meshname': '164k_fs_LR', 'T2wImage': '/root/projects/ciftify/ciftify/output/sub-50005/MNINonLinear/T2w.nii.gz', 'T1wImage': '/root/projects/ciftify/ciftify/output/sub-50005/MNINonLinear/T1w.nii.gz', 'Folder': '/root/projects/ciftify/ciftify/output/sub-50005/MNINonLinear', 'tmpdir': '/tmp/tmps9u7P2/164k_fs_LR'}

edickie commented 6 years ago

That is odd. Can you send me the cifti_recon_all.log file?

Also, I've tested more in python 3 than python 2. Will test in python 2 today to see if it's a python 2/3 issue.

On Mon, Jun 4, 2018, 7:09 AM baixibao, notifications@github.com wrote:

Hi, when I run ciftify_recon_all script in the newest version, some errors appear. By checking the path, I find two MNINonLinear folds generated.

/root/projects/ciftify/ciftify/output/sub-50005/T1w/Native /tmp/tmpzrV5el/T1w/native /root/projects/ciftify/ciftify/output/sub-50005/MNINonLinear/Native /tmp/tmpzrV5el/MNINonLinear/native _/root/projects/ciftify/ciftify/output/sub-50005/MNINonLinear_

Traceback (most recent call last): File "/usr/local/bin/ciftify_recon_all", line 11, in load_entry_point('ciftify==2.0.2', 'console_scripts', 'ciftify_recon_all')() File "/usr/local/lib/python2.7/site-packages/ciftify-2.0.2-py2.7.egg/ciftify/bin/ciftify_recon_all.py", line 1436, in main run_ciftify_recon_all(tmpdir, settings) File "/usr/local/lib/python2.7/site-packages/ciftify-2.0.2-py2.7.egg/ciftify/bin/ciftify_recon_all.py", line 106, in run_ciftify_recon_all os.path.join(subject.atlas_space_dir, 'Results')) File "/usr/local/lib/python2.7/site-packages/ciftify-2.0.2-py2.7.egg/ciftify/bin/ciftify_recon_all.py", line 400, in create_output_directories ciftify.utils.make_dir(mesh['Folder'], DRYRUN, suppress_exists_error = True) File "/usr/local/lib/python2.7/site-packages/ciftify-2.0.2-py2.7.egg/ciftify/utils.py", line 73, in make_dir os.makedirs(dir_name) File "/usr/local/lib/python2.7/os.py", line 157, in makedirs mkdir(name, mode) OSError: [Errno 17] File exists: '/root/projects/ciftify/ciftify/output/sub-50005/MNINonLinear'

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/edickie/ciftify/issues/59, or mute the thread https://github.com/notifications/unsubscribe-auth/AMl59qi5c6_jVWp6MSxcTCCbS054txY6ks5t5RWAgaJpZM4UY5D5 .

wangboc commented 6 years ago

en, my environment is Python 2.7.

edickie commented 6 years ago

I'll try to recreate the error in python 2 today.

On Mon, Jun 4, 2018, 7:35 AM baixibao, notifications@github.com wrote:

en, my environment is Python 2.7.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/edickie/ciftify/issues/59#issuecomment-394323824, or mute the thread https://github.com/notifications/unsubscribe-auth/AMl59roPu8JQgVUyqXxbDcbdQg4fdjUcks5t5Rt7gaJpZM4UY5D5 .

wangboc commented 6 years ago

cifti_recon_all.log

error_terminal.log

Hi, dear friend, here come two log files generated by recon_all script

edickie commented 6 years ago

Hi, I've confirmed that it is problem some of the new error handling code I added not working in python 2 (it was writing in python 3).

I can push a fix to this it of the code but I don't know if that is the only python 2 issue.. How difficult would it be for you to run ciftify in python 3?

wangboc commented 6 years ago

Thank u for your work. I will change mine to py3. It is better to explicitly require the environment to be python3 on the homepage, so others will not meet this problem.

Best regards !