backslash-f / ShockEmu

Keyboard support for Dualshock emulation for PS Remote Play (macOS)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

With file('mapKeys.h', 'w') as fp: NameError: name 'file' is not defined - 'mapKeys.h' file not found

acryllect opened this issue · comments

For some reason I'm having this issue. I use Python3 as default so i updated the code using https://www.pythonconverter.com/ but i was already having this issue before updating the code. I have no clue why this happens and i'm not too into code. The full Terminal output is as follows:

alex@MacBook-Pro shockemu % ./build.sh gamepad.se
gcc -DDEBUG -o gpad-daemon gpad-daemon.c gamepad.c -framework Foundation -framework IOKit
Traceback (most recent call last):
  File "shockemu.py", line 36, in <module>
    with file('mapKeys.h', 'w') as fp:
NameError: name 'file' is not defined
iohid_wrap.m:426:10: fatal error: 'mapKeys.h' file not found
#include "mapKeys.h"
         ^~~~~~~~~~~
1 error generated.

Yes, same. As a workaround, in the build.sh file, change from:

python shockemu.py $1

... to:

python2 shockemu.py $1

(Assuming you have Python 2 installed, if not: brew install python@2)

The correct way for solving this issue is to migrate shockemu.py to Python 3, which I personally won't do because Python is not my thing. :-)

Labeling this as enhancement / help wanted

I actually just pushed the workaround 88a2e83

Thank you! My personal workaround was creating a temporary python env which i can activate when running the program. Now my issue is with the mouse, which moves very randomly and i'm not a good programmer (or even a programmer at that) so i have no clue why its so janky. Could I email you for help?

Sorry I can't help with that as this repo is more like "keyboard only". I myself don't use the mouse at all.