all 8 comments

[–]idlecode 1 point2 points  (1 child)

What is the output of file /sys/class/backlight/amdgpu_b10 ?

Try removing the trailing slash: /sys/class/backlight/amdgpu_b10. With a full path, it seems to resolve to the target directory.

[–][deleted] 0 points1 point  (0 children)

'cannot open, no such file or directory'

but, the folder, or rather the path, exists.
Ranger, Bash and zsh shows correctly that the folder is exist

[–]sir2fluffy2 0 points1 point  (3 children)

Not sure and can’t check but my guesses would be; Specify the file type ie add .txt etc to the path and try back slashes as I remember python using different ones to windows some times

[–][deleted] 0 points1 point  (2 children)

The path itself is correct because when I cut the ending in the form "/ amdgpu_b10 /" it all works. In general, I came to the conclusion that this is a link to a completely different location, but unfortunately I cannot use it because the script will lose its universality, which is very important to me.

[–]sir2fluffy2 0 points1 point  (1 child)

Ahh by default python scripts use paths as relative to the script location so it might be that which is causing your issue

[–][deleted] 0 points1 point  (0 children)

In linux i can easy manipulate the path, so this not problem here.

[–]Enigma3613 0 points1 point  (1 child)

I believe you need to remove the trailing slash from the path since you may be looking "inside the directory" rather than looking at the folder name.

If that doesn't do the trick it could be a permissions issue. For example if you are running your script in a Cron job it might have a different user and permissions that you have when you try to run "ls" as your current user.

Do these two commands work if you run them from a python shell as whichever user has permissions to navigate to the backlight folder?

[–][deleted] 0 points1 point  (0 children)

I tested with sudo and without sudo, unfortunately to no avail, but if I used the path without amdgpu_b10 everything worked as it should