backslash-f / ShockEmu

Keyboard support for Dualshock emulation for PS Remote Play (macOS)
43 stars 13 forks source link

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

Closed acryllect closed 4 years ago

acryllect commented 4 years ago

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.
backslash-f commented 4 years ago

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

backslash-f commented 4 years ago

I actually just pushed the workaround https://github.com/backslash-f/ShockEmu/commit/88a2e83cadb73a231d20d40a28afd1a5961a32c6

acryllect commented 4 years ago

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?

backslash-f commented 4 years ago

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