Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ev3dev/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import mmap
import ctypes
import re
import stat
from os.path import abspath
from PIL import Image, ImageDraw
from struct import pack, unpack
Expand All @@ -58,8 +59,10 @@ def file_handle(self, path, binary=False):
"""Manages the file handle cache and opening the files in the correct mode"""

if path not in self._cache:
r_ok = os.access(path, os.R_OK)
w_ok = os.access(path, os.W_OK)
mode = stat.S_IMODE(os.stat(path)[stat.ST_MODE])

r_ok = mode & stat.S_IRGRP
w_ok = mode & stat.S_IWGRP

if r_ok and w_ok:
mode = 'a+'
Expand Down