Switching between runtime and standalone

I’m doing the following to switch between “runtime” and “standalone”.

 prefs.reset_to_defaults()
 set_device('runtime')

 prefs.reset_to_defaults()
 set_device('cpp_standalone')

 prefs.reset_to_defaults()
 set_device('runtime')

This runs fine in brian2.5 but the command “prefs.reset_to_defaults()” has the following error in brian2.4.2:

 TypeError: a bytes-like object is required, not 'str'

Is it fine to skip the “prefs.reset_to_defaults()” command and simply use set_device() to switch between “runtime” and “standalone” back and forth?

Standalone mode and runtime mode do not change the preferences (but e.g. brian2genn does), so the reset_to_defaults call is not necessary. The error you encountered was fixed a while ago (brian-team/brian2#1342), but that was after the release of 2.4.2.

1 Like