Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

got some problem when execute freesurfer command by anaconda #5

Open
MaJie414 opened this issue Jun 21, 2019 · 4 comments
Open

got some problem when execute freesurfer command by anaconda #5

MaJie414 opened this issue Jun 21, 2019 · 4 comments

Comments

@MaJie414
Copy link

No description provided.

@MaJie414 MaJie414 changed the title got some problem when 额、xecute Command got some problem when execute freesurfer command by anaconda Jun 21, 2019
@MaJie414
Copy link
Author

`import subprocess
def tee_output(command, log_file):
"""Write the output of a command to a logfile as well as stdout."""
print('Writing the output of the command below to', log_file)
print(' '.join(command))
with open(log_file, 'wb') as fid:
proc = subprocess.Popen(
command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
for line in proc.stdout:
fid.write(line)
if proc.wait() != 0:
raise RuntimeError('Command failed')

subject = 'dd'
tee_output(['recon-all', '-all', '-s', subject, '-sd', '/media/mj/D/sharefolder/Linux_soft/freesurfer/subjects',
'-i', '/home/mj/Downloads/rT1.nii'],
'dd.txt')
`
My code is here.
I got an error when executing this code.
image

@wmvanvliet
Copy link
Collaborator

You don't have freesurfer installed.

@MaJie414
Copy link
Author

I already have installed the freesurfer. It's work when I copy the command(recon-all -all -s dd -i /home/mj/Downloads/rT1.nii) to shell window. But it couldn't execute by python, even using os.system() still report an error.

@wmvanvliet
Copy link
Collaborator

if it works if you cope/paste the command in your terminal, then it must be a path issue. Is your python somehow using a different $PATH environment variable? Can you try editing the code of the script to contain the full path to the recon-all program?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants