question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG: set_config() doesn't change value accessed via get_config()

See original GitHub issue

It’s probably a bad setup on my part, but I can’t seem to make mne.bem.make_watershed_bem to work.

I try to explicitly export and source Freesurfer and MNE © in the bash and/or via subprocess or os.sys(), but I keep having the following error with the command

mne.bem.make_watershed_bem(subject, subjects_dir, overwrite=True)

Running mri_watershed for BEM segmentation with the following parameters:

SUBJECTS_DIR = /data/subjects
SUBJECT = hn120493
Results dir = /data/subjects/hn120493/bem/watershed

Running subprocess: mri_watershed -useSRAS -surf /data/subjects/hn120493/bem/watershed/hn120493 /data/subjects/hn120493/mri/T1.mgz /data/subjects/hn120493/bem/watershed/ws
Command not found: mri_watershed
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-5-f8d51723d992> in <module>()
----> 1 mne.bem.make_watershed_bem(subject, subjects_dir, overwrite=True)

/home/jrking/mne-python/mne/bem.pyc in make_watershed_bem(subject, subjects_dir, overwrite, volume, atlas, gcaatlas, preflood, show, verbose)

/home/jrking/mne-python/mne/utils.pyc in verbose(function, *args, **kwargs)
    627         with use_log_level(verbose_level):
    628             return function(*args, **kwargs)
--> 629     return function(*args, **kwargs)
    630 
    631 

/home/jrking/mne-python/mne/bem.pyc in make_watershed_bem(subject, subjects_dir, overwrite, volume, atlas, gcaatlas, preflood, show, verbose)
   1061                 'Results dir = %s\n' % (subjects_dir, subject, ws_dir))
   1062     os.makedirs(op.join(ws_dir, 'ws'))
-> 1063     run_subprocess(cmd, env=env, stdout=sys.stdout, stderr=sys.stderr)
   1064 
   1065     if op.isfile(T1_mgz):

/home/jrking/mne-python/mne/utils.pyc in run_subprocess(command, verbose, *args, **kwargs)

/home/jrking/mne-python/mne/utils.pyc in verbose(function, *args, **kwargs)
    627         with use_log_level(verbose_level):
    628             return function(*args, **kwargs)
--> 629     return function(*args, **kwargs)
    630 
    631 

/home/jrking/mne-python/mne/utils.pyc in run_subprocess(command, verbose, *args, **kwargs)
    930     logger.info("Running subprocess: %s" % ' '.join(command))
    931     try:
--> 932         p = subprocess.Popen(command, *args, **kwargs)
    933     except Exception:
    934         logger.error('Command not found: %s' % (command[0],))

/home/jrking/anaconda/lib/python2.7/subprocess.pyc in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags)
    708                                 p2cread, p2cwrite,
    709                                 c2pread, c2pwrite,
--> 710                                 errread, errwrite)
    711         except Exception:
    712             # Preserve original exception in case os.close raises.

/home/jrking/anaconda/lib/python2.7/subprocess.pyc in _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, to_close, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite)
   1333                         raise
   1334                 child_exception = pickle.loads(data)
-> 1335                 raise child_exception
   1336 
   1337 

OSError: [Errno 2] No such file or directory

However, when running the command directly in the terminal it works fine mri_watershed -useSRAS -surf /data/subjects/hn120493/bem/watershed/hn120493 /data/subjects/hn120493/mri/T1.mgz /data/subjects/hn120493/bem/watershed/ws Command not found: mri_watershed.

I can’t get the pipeline to work though, because I am still missing the subject_surface file.

Any idea what I can do?.. Sorry for the noise.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:15 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
larsonercommented, Jun 1, 2016

Try it with mri_watershed --version

0reactions
agramfortcommented, Jul 19, 2016
  1. is fine with me
Read more comments on GitHub >

github_iconTop Results From Across the Web

Change service config parameters at runtime - laravel
You can set config values dynamically at runtime with config() helper: config(['services.mailgun' => $arrayWithNewSettings]);.
Read more >
pbjs.setConfig(options) for Header Bidding
Every call to setConfig overwrites supplied values at the top level. e.g. if ortb2 is provided as a value, any previously-supplied ortb2 values...
Read more >
spf13/viper: Go configuration with fangs - GitHub
Like BindEnv , the value is not set when the binding method is called, but when it is accessed. This means you can...
Read more >
ConfigParser – Work with configuration files - PyMOTW
Because the value is computed by get(), changing one of the settings being used by the url value changes the return value. $...
Read more >
logging.config — Logging configuration — Python 3.11.1 ...
config module has a callable attribute dictConfigClass which is initially set to DictConfigurator . You can replace the value of dictConfigClass with a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found