Skip to content

Commit 3e00d6c

Browse files
committed
Ignore failure to import fcntl
Fixes #190
1 parent def9738 commit 3e00d6c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ev3dev/core.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
import io
4242
import fnmatch
4343
import numbers
44-
import fcntl
4544
import array
4645
import mmap
4746
import ctypes
@@ -52,6 +51,14 @@
5251
from struct import pack, unpack
5352
from subprocess import Popen
5453

54+
try:
55+
# This is a linux-specific module.
56+
# It is required by the Button() class, but failure to import it may be
57+
# safely ignored if one just needs to run API tests on Windows.
58+
import fcntl
59+
except ImportError:
60+
print("WARNING: Failed to import fcntl. Button class will be unuseable!")
61+
5562
INPUT_AUTO = ''
5663
OUTPUT_AUTO = ''
5764

0 commit comments

Comments
 (0)