io = iohub.launchHubServer()
evokes this error message:
IOError: [Errno 13] Permission denied: ‘C:\Program Files\JetBrains\PyCharm Community Edition 2017.2.4\helpers\pydev\.iohpid’
The stack trace points to this line:
In this file:
“C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\iohub\client_init_.py”, line 990, in _startServer
I am running Psychopy on Windows 10 Home version 17.09 build 16299.64 and PyCharm version 2017.3.
So the user does not have permissions to create the “.iohpid” file in that directory. As a work-around, I’ve modified \psychopy\iohub\client_init_.py to put “.iohpid” file in ~/ instead, where of course the user would always have write permissions. That’s a pretty good solution but I’m not sure that it is perfect. If resources iohub uses are per-system and one user logs out leaving the IOHub server running and another user logs in and starts up the IOHub server then those could conflict. Have not looked into whether that would really be a problem or not. A system temp directory might be a better choice of location in case that turns out to be a real problem.
Also, io = iohub.launchHubServer() works from the Python command line but not from a script. Even though iopFileName resolves to the same path under both conditions.
There is some unexplained weirdness here: Why does my system exhibit this bug when, presumably, others do not? I’ve found only two references to the bug:
I could not find it logged in the bug tracker at the PsychoPy github project, but it’s always possible that I overlooked something. Release notes for PsychoPy 1.85.3 say “Fix to iohub.launchHubServer() under Linux…” and perhaps it is related. That also suggests that I should have found a related issue in the bug tracker, so I probably did overlook it.