# : \`read' access denied for

**URL:** https://racket.discourse.group/t/read-access-denied-for/1834
**Category:** Questions & Answers
**Created:** [March 25, 2023, 1:43pm UTC](https://racket.discourse.group/t/read-access-denied-for/1834 "2023-03-25T13:43:20Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![bsassoli](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/bsassoli/32/1074_2.png) [@bsassoli](https://racket.discourse.group/u/bsassoli)
#### Post date: [March 25, 2023, 1:43pm UTC](https://racket.discourse.group/t/read-access-denied-for/1834/1 "2023-03-25T13:43:20Z")

</div>

Hi! Newish to Racket and I hope this is appropriate. I am going thought the material in [Berkeley's CS61A](http://berkeley-cs61as.github.io) and I am running into the following error when I run their autograder locally as in  
`racket -tm grader.rkt -- hw1-tests.rkt hw1.rkt`

```scheme
An error occurred:
file-or-directory-modify-seconds: `read' access denied for /Users/bernardino/Library/Preferences/org.racket-lang.prefs.rktd

```

I looked around and did find some Github issue but it wasn't helpful. I could just extract all their tests but I would like to understand what's off.

Any pointers?  
Thank you

---

<div class="post-metadata">

### Author: ![benknoble](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/benknoble/32/16_2.png) [@benknoble](https://racket.discourse.group/u/benknoble)
#### Post date: [March 27, 2023, 3:03pm UTC](https://racket.discourse.group/t/read-access-denied-for/1834/2 "2023-03-27T15:03:07Z")

</div>

I'm not sure how or why this happened, but I would check the permissions on `~/Library/Preferences/org.racket-lang.prefs.rktd` and try to adjust them with `chmod`.

If that doesn't work, maybe removing that file will cause it to be re-created? Or re-installing Racket?

---

<div class="post-metadata">

### Author: ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)
#### Post date: [March 27, 2023, 3:21pm UTC](https://racket.discourse.group/t/read-access-denied-for/1834/3 "2023-03-27T15:21:54Z")

</div>

If Ben's advice doesn't work, we'll need to know your OS and how you installed Racket.

---

<div class="post-metadata">

### Author: ![gus-massa](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/gus-massa/32/507_2.png) [@gus-massa](https://racket.discourse.group/u/gus-massa)
#### Post date: [March 27, 2023, 6:42pm UTC](https://racket.discourse.group/t/read-access-denied-for/1834/4 "2023-03-27T18:42:46Z")

</div>

I'm not sure if this is relevant, but are you trying to run the grader while DrRacket is open?

---

<div class="post-metadata">

### Author: ![bsassoli](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/bsassoli/32/1074_2.png) [@bsassoli](https://racket.discourse.group/u/bsassoli)
#### Post date: [March 29, 2023, 1:42pm UTC](https://racket.discourse.group/t/read-access-denied-for/1834/5 "2023-03-29T13:42:11Z")

</div>

Thanks everyone for the support and apologies for the late feedback... I tried changing permissions and even running as `sudo`. Nothing. Then deleted the incriminated file and finally reinstalled everything. Still getting that error.  
@soegaard I'm running MacOS Ventura13.0 on an Apple M1 Silicon MacBook Air. Racket was installed with the provided installer from the racket-lang site for the Silicon architecture ....

At this stage I am just being stubborn I guess, it's not a huge deal.

---

<div class="post-metadata">

### Author: ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)
#### Post date: [March 29, 2023, 2:00pm UTC](https://racket.discourse.group/t/read-access-denied-for/1834/6 "2023-03-29T14:00:20Z")

</div>

In that case I suspect the fault is in the grader.

Is it this one?

[Homework 0.1 - CS 61AS Textbook](http://berkeley-cs61as.github.io/textbook/homework-0.1.html#sub2)

If so, just run the test manually:

[https://inst.eecs.berkeley.edu//~cs61as/autograder/tests/hw0-1-tests.rkt](https://inst.eecs.berkeley.edu//~cs61as/autograder/tests/hw0-1-tests.rkt)

E.g. for this test:

```scheme
  (define/test
    sum-of-squares-tests
    (check-equal? (sum-of-squares 3 4) 25)
    (check-equal? (sum-of-squares -1 -2) 5)
    (check-equal? (sum-of-squares 1 2) 5))

```

try the expressions `(sum-of-squares 3 4)`, `(sum-of-squares -1 -2)` etc in the repl  
and see if you get the right result.

---

<div class="post-metadata">

### Author: ![robby](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/robby/32/7_2.png) [@robby](https://racket.discourse.group/u/robby)
#### Post date: [March 29, 2023, 2:23pm UTC](https://racket.discourse.group/t/read-access-denied-for/1834/7 "2023-03-29T14:23:00Z")

</div>

A possibility, related to @soegaard 's diagnosis,a is that the solution you're trying to run through the autograder is using a library that the homework's authors did not intend (e.g., the framework) and that library is, behind the scenes, trying to use the preferences file.

---

<div class="post-metadata">

### Author: ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)
#### Post date: [March 29, 2023, 2:42pm UTC](https://racket.discourse.group/t/read-access-denied-for/1834/8 "2023-03-29T14:42:54Z")

</div>

The grader is here:

[https://inst.eecs.berkeley.edu//~cs61as/autograder/grader.rkt](https://inst.eecs.berkeley.edu//~cs61as/autograder/grader.rkt)

And the evaluator has this:

```scheme
#:allow-for-require (list '(planet dyoo/simply-scheme)
			       'rackunit
			       'rackunit/text-ui
			       submission-file)))

```

So it looks like, the grader want's you to use simply-scheme?

---

<div class="post-metadata">

### Author: ![bsassoli](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/bsassoli/32/1074_2.png) [@bsassoli](https://racket.discourse.group/u/bsassoli)
#### Post date: [March 29, 2023, 3:37pm UTC](https://racket.discourse.group/t/read-access-denied-for/1834/9 "2023-03-29T15:37:42Z")

</div>

@soegaard (and everyone) thanks

> it looks like, the grader want's you to use simply-scheme?

How do I do that?

---

<div class="post-metadata">

### Author: ![bsassoli](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/bsassoli/32/1074_2.png) [@bsassoli](https://racket.discourse.group/u/bsassoli)
#### Post date: [March 29, 2023, 3:38pm UTC](https://racket.discourse.group/t/read-access-denied-for/1834/10 "2023-03-29T15:38:52Z")

</div>

Yes, I am already running the tests manually (as I mentioned in the first post) but like I said I'd be interested in just solving what's wrong for the sake of it

---

<div class="post-metadata">

### Author: ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)
#### Post date: [March 29, 2023, 4:25pm UTC](https://racket.discourse.group/t/read-access-denied-for/1834/11 "2023-03-29T16:25:13Z")

</div>

Looking more closely at the Berkeley page, I see there is a template for the first homework.

It just starts with `#lang racket` so I don't think they are using Simply Scheme at all.  
So I think it is safe to forget about Simply Scheme.

[https://inst.eecs.berkeley.edu//~cs61as/templates/hw0-1.rkt](https://inst.eecs.berkeley.edu//~cs61as/templates/hw0-1.rkt)

---

<div class="post-metadata">

### Author: ![bsassoli](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/bsassoli/32/1074_2.png) [@bsassoli](https://racket.discourse.group/u/bsassoli)
#### Post date: [March 29, 2023, 4:51pm UTC](https://racket.discourse.group/t/read-access-denied-for/1834/12 "2023-03-29T16:51:28Z")

</div>

Yeah I was wondering about that ....  
This is what I found but let's say it's not exactly clear to me...

> <https://github.com/racket/racket/issues/3920>
>
> Origionaly from https://groups.google.com/forum/?fromgroups#!searchin/racket-use…rs/libobj%7Csort:relevance/racket-users/W\_-4aN7kPyI/cwgwz2xIBAAJ
> 
> Two small example of this:
> 
> \`\`\`
> (make-module-evaluator \`(module m racket (require 2htdp/image)))
> \`\`\`
> 
> \`\`\`
> (make-evaluator 'racket #:requires '(2htdp/image))
> \`\`\`
> 
> These errors with one of the following, depending on the machine.
> 
> \`\`\`
> file-or-directory-modify-seconds: \`read' access denied for
> /Users/florence/Library/Preferences/org.racket-lang.prefs.rktd
> \`\`\`
> 
> \`\`\`
> file-exists?: \`exists' access denied for libobj.so
> \`\`\`
> 
> \`\`\`
> file-exists?: \`exists' access denied for libobj.dylib
> \`\`\`
> 
> \`\`\`
> file-exists?: \`exists' access denied for libpng16.so.16
> \`\`\`
> 
> I'm not sure when this broke, but it worked on \`6.2.1\` (When using the handin server at least).
> 
> I also have not been able to find workaround by setting \`sandbox-path-permissions\`, other than setting \`'read\` for \`"/"\`.

---

<div class="post-metadata">

### Author: ![robby](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/robby/32/7_2.png) [@robby](https://racket.discourse.group/u/robby)
#### Post date: [March 29, 2023, 9:36pm UTC](https://racket.discourse.group/t/read-access-denied-for/1834/13 "2023-03-29T21:36:13Z")

</div>

Does your code use the `2htdp/image` library?

---

<div class="post-metadata">

### Author: ![robby](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/robby/32/7_2.png) [@robby](https://racket.discourse.group/u/robby)
#### Post date: [March 30, 2023, 12:31am UTC](https://racket.discourse.group/t/read-access-denied-for/1834/14 "2023-03-30T00:31:08Z")

</div>

Also, reading over that issue, it looks like you might simply need to add `(require racket/gui/base)` to the grading script (outside the sandbox, so not in your sample solution).

---

<div class="post-metadata">

### Author: ![dmegas](https://avatars.discourse-cdn.com/v4/letter/d/a3d4f5/32.png) [@dmegas](https://racket.discourse.group/u/dmegas)
#### Post date: [November 5, 2023, 9:05pm UTC](https://racket.discourse.group/t/read-access-denied-for/1834/15 "2023-11-05T21:05:21Z")

</div>

Just my two cents after facing the same issue (but for `hw2.rkt` of the same course) - what I had to do to make the tests run was change the `sandbox-path-permissions` in the `grader.rkt` from  
` [sandbox-path-permissions (list '(exists "/"))]`  
to  
` [sandbox-path-permissions (list '(execute "/"))]`  
after looking at [this](https://docs.racket-lang.org/reference/Sandboxed_Evaluation.html#%28def._%28%28lib._racket%2Fsandbox..rkt%29._sandbox-path-permissions%29%29) part of the documentation.  
Still don't understand the why, but I hope this will help anyone facing the same issue.

UPDATE: Actually, now that I thought this through, the less permissive  
`[sandbox-path-permissions (list '(read "/"))]`  
can be used, with the same success.

---

<div class="post-metadata">

### Author: ![bsassoli](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/bsassoli/32/1074_2.png) [@bsassoli](https://racket.discourse.group/u/bsassoli)
#### Post date: [March 16, 2024, 10:04pm UTC](https://racket.discourse.group/t/read-access-denied-for/1834/16 "2024-03-16T22:04:42Z")

</div>

Only saw this now! Thanks, it worked.
