IOError: [Errno 13] Permission denied: 'Values.txt'

Operating system:win 7
Slicer version:3Dslicer 4.9.0-2017-11-01 r26541
hello all

as seen in the screenshot,i was trying to save an array,then it came out an erro,but I can’t find out what I am doing wrong! the code was copied from here https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository

Thanks in advance!!
bug

You are probably trying to write in a read-only program directory. Try specifying an absolute path (C:\path\to\somewhere\values.txt) instead.

I think it’s still a little difficult for me to specify an absolute path:disappointed_relieved:
how about print it out?how to do?
seem not good enough:neutral_face:不过

GOD!I try it out :heart_eyes: thank you!!
bug2

I would recommend you to complete Python and numpy tutorials, but to answer your question specifically, this should work:

import numpy as np
values=np.array([1,2,3,7,4,3])
fullPath=slicer.app.defaultScenePath+"/values.txt"
np.savetxt(fullPath,values)
print(fullPath)

Of course, it is much more efficient to visualize 3D arrays as images (by slicing, volume rendering, segmenting, etc). If you hover over any position in the image, you can see the coordinate and grayscale value in the data probe widget in the bottom-left corner.

yes,you are right!that what thay say"书到用时方恨少" :joy: