Old util.Function needed

the “new” API of util.Function with function_str as input ruined all my scripts. Our own Phabricator server is down of course and now I am searching for the old code.

Can someone point me to the old version.

I need the old behaviour
util.Function(input_names=[‘in1’, ‘in2’],
output_names=[‘out1’, ‘ou2’],
function=my_function), name=‘my_function’)

and NOT function_str = string definition


The only recent change in Function is that input_names and output_names are no longer required. util.Function(function=my_function) should work just fine.

Can you post a small script that produces the issue you’re seeing, and a traceback of the error you’re getting?

Oh Yes, I got it. In my function I have:

savetxt(fid, stats, fmt=’ %.2f, %.2f, %.2f’, header = ‘voxel, volume [mm³], beta’, footer = footer)

Non-ASCII character ‘\xc2’ in file utilfunction.py on line 25, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

WIthout ³ it’s fine. Why was it working for years before?

I think this may be an issue @mgxd was recently working on.

hi @cni-md, are you using python 2?
if so, can you try changing the line in your function to

savetxt(fid, stats, fmt=str(’ %.2f, %.2f, %.2f’), header=str(‘voxel, volume [mm³], beta’), footer = footer)

There is a pull request in progress that addresses this problem, but we encourage users to migrate over to python 3.

Yes, I am using still 2.7. python 3 is not installed in a usable way (no setup-tools, etc). But this and the outdated numpy version is a good reason to ask for a release-upgrade.