Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qmk compile-json crashes with TypeError #6428

Closed
3 tasks
focusaurus opened this issue Jul 28, 2019 · 8 comments · Fixed by #6506
Closed
3 tasks

qmk compile-json crashes with TypeError #6428

focusaurus opened this issue Jul 28, 2019 · 8 comments · Fixed by #6506
Labels

Comments

@focusaurus
Copy link

Describe the Bug

Trying to run qmk-compile-json path/to/my/layout.json crashes with a TypeError. Looks like passing an unexpected argument to subprocess.run. I'm trying to run with a python3 virtualenv.

TraceBack:

./bin/qmk-compile-json ~/projects/ergodox/config.qmk.fm/2019-01-28-qwe-navpunc-num.json
Traceback (most recent call last):
  File "./bin/qmk-compile-json", line 41, in <module>
    result = subprocess.run(command, text=True, capture_output=True)
  File "/usr/lib/python3.6/subprocess.py", line 423, in run
    with Popen(*popenargs, **kwargs) as process:
TypeError: __init__() got an unexpected keyword argument 'text'

System Information

  • Keyboard: infinity ergodox
  • Operating system: Linux Mint 19.1 Cinnamon
  • AVR GCC version:
  • ARM GCC version: avr-gcc (GCC) 5.4.0
  • QMK Firmware version: 0.6.439
  • Any keyboard related software installed?
    • AutoHotKey
    • Karabiner
    • Other:

Additional Context

I didn't initially have pip3 available. I tried running util/linux_install.sh without any pip3, after activating a python3 virtualenv where pip3 was early in the PATH, and after manually installing the python3-pip debian package.

I think you may need to add python3-pip to your required package list for debian-based distros, but even after installing that I get the TypeError.

@focusaurus
Copy link
Author

Note I was able to work around this and get the command to work by commenting out some stuff as per this diff:

diff --git a/bin/qmk b/bin/qmk
index c34365bed..40af28d13 100755
--- a/bin/qmk
+++ b/bin/qmk
@@ -37,12 +37,12 @@ with open('requirements.txt', 'r') as fd:
             exit(255)
 
 # Figure out our version
-command = ['git', 'describe', '--abbrev=6', '--dirty', '--always', '--tags']
-result = subprocess.run(command, text=True, capture_output=True)
+#command = ['git', 'describe', '--abbrev=6', '--dirty', '--always', '--tags']
+#result = subprocess.run(command)
 
-if result.returncode == 0:
-    os.environ['QMK_VERSION'] = 'QMK ' + result.stdout.strip()
-else:
+#if result.returncode == 0:
+#    os.environ['QMK_VERSION'] = 'QMK ' + result.stdout.strip()
+#else:
 os.environ['QMK_VERSION'] = 'QMK ' + strftime('%Y-%m-%d-%H:%M:%S')
 
 # Setup the CLI

@drashna drashna added the bug label Aug 1, 2019
@drashna
Copy link
Member

drashna commented Aug 1, 2019

@skullydazed

@skullydazed
Copy link
Member

Thanks for your report here. Sorry for the delay looking at it I've been traveling and am now working through my backlog.

It looks like I accidentally used a feature that was added in python 3.7. I'll generate a PR to fix that.

@skullydazed
Copy link
Member

Can you git pull and give it a try again? It should be working for you now.

@focusaurus
Copy link
Author

Looks like it's still using capture_output which is a new kwarg in 3.7.

./bin/qmk-compile-json ~/projects/ergodox/config.qmk.fm/2019-01-28-qwe-navpunc-num.json
Traceback (most recent call last):
  File "./bin/qmk-compile-json", line 41, in <module>
    result = subprocess.run(command, universal_newlines=True, capture_output=True)
  File "/usr/lib/python3.6/subprocess.py", line 423, in run
    with Popen(*popenargs, **kwargs) as process:
TypeError: __init__() got an unexpected keyword argument 'capture_output'

@focusaurus
Copy link
Author

I hacked the shebang to run python3.7 but I'm stuck in a loop where I get this message:

Your QMK build environment is not fully setup!

Please run `./util/qmk_install.sh` to setup QMK.

So I run ./util/qmj_install.sh but it keeps telling me it's not setup still.

@skullydazed
Copy link
Member

Sorry for the delay getting back to this. #6592 should fix you up now. I've also opened #6588 which should help us catch this sort of thing in the future.

@focusaurus
Copy link
Author

Awesome, thanks! I can confirm it works without modification for me now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants