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

Invalid keyword arguments #280

Closed
xged opened this issue Jun 7, 2016 · 2 comments
Closed

Invalid keyword arguments #280

xged opened this issue Jun 7, 2016 · 2 comments

Comments

@xged
Copy link

xged commented Jun 7, 2016

import os
import subprocess
from plumbum.cmd import git

cmd = git["log", "--format='oneline'"]

print(str(cmd))
#$ /usr/bin/git log --format='oneline'
os.system(str(cmd)) # works fine
subprocess.call(str(cmd), shell=True) # works fine
subprocess.call(str(cmd).split())
#$ fatal: invalid --pretty format: 'oneline'
cmd()
#$ Traceback (most recent call last):
#$   File "git.py", line 27, in <module>
#$     cmd()
#$   File "/home/xged/miniconda3/envs/git/lib/python3.5/site-packages/plumbum/commands/base.py", line 90, in __call__
#$     return self.run(args, **kwargs)[1]
#$   File "/home/xged/miniconda3/envs/git/lib/python3.5/site-packages/plumbum/commands/base.py", line 220, in run
#$     return p.run()
#$   File "/home/xged/miniconda3/envs/git/lib/python3.5/site-packages/plumbum/commands/base.py", line 182, in runner
#$     return run_proc(p, retcode, timeout)
#$   File "/home/xged/miniconda3/envs/git/lib/python3.5/site-packages/plumbum/commands/processes.py", line 206, in run_proc
#$     return _check_process(proc, retcode, timeout, stdout, stderr)
#$   File "/home/xged/miniconda3/envs/git/lib/python3.5/site-packages/plumbum/commands/processes.py", line 23, in _check_process
#$     proc.verify(retcode, timeout, stdout, stderr)
#$   File "/home/xged/miniconda3/envs/git/lib/python3.5/site-packages/plumbum/machines/base.py", line 22, in verify
#$     stdout, stderr)
#$ plumbum.commands.processes.ProcessExecutionError: Command line: ['/usr/bin/git', 'log', "--format='oneline'"]
#$ Exit code: 128
#$ Stderr:  | fatal: invalid --pretty format: 'oneline'
@henryiii
Copy link
Collaborator

cmd = git["log", "--format=oneline"]

works. I think this has to do with Plumbum's auto quoting.

@xged xged closed this as completed Jun 10, 2016
@henryiii
Copy link
Collaborator

Eventually, I'll try to look at the quoting model and see if I can improve it. Thanks!

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

No branches or pull requests

2 participants