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

**URL:** <https://discourse.slicer.org/t/ioerror-errno-13-permission-denied-values-txt/1577>\
**Category:** Support\
**Created:** [December 2, 2017, 5:54pm UTC](https://discourse.slicer.org/t/ioerror-errno-13-permission-denied-values-txt/1577 "2017-12-02T17:54:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![happyle](https://avatars.discourse-cdn.com/v4/letter/h/ec9cab/32.png) [@happyle](https://discourse.slicer.org/u/happyle)\
**Post date:** [December 2, 2017, 5:54pm UTC](https://discourse.slicer.org/t/ioerror-errno-13-permission-denied-values-txt/1577/1 "2017-12-02T17:54:24Z")

</div>

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 [Documentation/Nightly/ScriptRepository - Slicer Wiki](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository)

Thanks in advance!!  
 ![bug](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/0/b0897ba845e90311f09f0a23fef146a20502b268.jpeg)

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ihnorton/32/9_2.png) [@ihnorton](https://discourse.slicer.org/u/ihnorton)\
**Post date:** [December 2, 2017, 6:38pm UTC](https://discourse.slicer.org/t/ioerror-errno-13-permission-denied-values-txt/1577/2 "2017-12-02T18:38:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![happyle](https://avatars.discourse-cdn.com/v4/letter/h/ec9cab/32.png) [@happyle](https://discourse.slicer.org/u/happyle)\
**Post date:** [December 3, 2017, 7:53am UTC](https://discourse.slicer.org/t/ioerror-errno-13-permission-denied-values-txt/1577/3 "2017-12-03T07:53:56Z")

</div>

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: ![不过](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/a/d/ad604a128c9fe77f92321ea404bdfb3302f68e41.jpeg)

---

<div class="post-metadata">

**Author:** ![happyle](https://avatars.discourse-cdn.com/v4/letter/h/ec9cab/32.png) [@happyle](https://discourse.slicer.org/u/happyle)\
**Post date:** [December 3, 2017, 8:49am UTC](https://discourse.slicer.org/t/ioerror-errno-13-permission-denied-values-txt/1577/4 "2017-12-03T08:49:10Z")

</div>

GOD!I try it out 😍 thank you!!  
 ![bug2](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/c/fc42a2f9d18c16f40d1aef84ec9f45d61961b3d9.jpeg)

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [December 3, 2017, 12:49pm UTC](https://discourse.slicer.org/t/ioerror-errno-13-permission-denied-values-txt/1577/5 "2017-12-03T12:49:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![happyle](https://avatars.discourse-cdn.com/v4/letter/h/ec9cab/32.png) [@happyle](https://discourse.slicer.org/u/happyle)\
**Post date:** [December 5, 2017, 5:50am UTC](https://discourse.slicer.org/t/ioerror-errno-13-permission-denied-values-txt/1577/6 "2017-12-05T05:50:37Z")

</div>

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