1

Whenever I try to pass an argument to Kupfer I am getting an error (debug run) that says that "TypeError: glib.spawn_async: second argument must be a sequence of strings". I have no idea why that is the case. I am just trying to pass some arguments using the text mode to a bash script ("command $*") or any other executable but this error making it impossible to use Kupfer for such purposes :(

This app is not maintained much. My Python knowledge of unicode and similar issues is very limited. I would like to either fix this issue or if this is not a bug find the right way to use that feature.

How can I address this issue in the code? I want to patch it so I can us it.

github page https://github.com/engla/kupfer

error messgae http://pastebin.com/rUJDnetL

Traceback (most recent call last):
  File "/usr/share/kupfer/kupfer/ui/browser.py", line 1615, in _activate
    self.data_controller.activate(ui_ctx=self._make_gui_ctx())
  File "/usr/share/kupfer/kupfer/core/data.py", line 800, in activate
    res, ret = ctx.run(leaf, action, sobject, ui_ctx=ui_ctx)
  File "/usr/share/kupfer/kupfer/core/commandexec.py", line 303, in run
    ret = activate_action(execution_token, obj, action, iobj)
  File "/usr/share/kupfer/kupfer/core/commandexec.py", line 80, in activate_action
    return _activate_action_single(obj, action, iobj, kwargs)
  File "/usr/share/kupfer/kupfer/core/commandexec.py", line 86, in _activate_action_single
    ret = action.activate(obj, iobj, **kwargs)
  File "/usr/share/kupfer/kupfer/plugin/commands.py", line 131, in activate
    utils.AsyncCommand(argv, finish_callback, None, stdin=leaf.object)
  File "/usr/share/kupfer/kupfer/utils.py", line 126, in __init__
    standard_error=True, flags=flags, envp=env)
TypeError: glib.spawn_async: second argument must be a sequence of strings
yarun can
  • 2,871
  • 5
  • 25
  • 27
  • Add some code into the `__init__` function to print argv right before glib.spawn_async is called on it. It's supposed to be a list of `str` objects, if its not, you know what the issue is. Then you just need to work backwards to figure out how to fix it. – dano May 12 '14 at 19:21
  • Note that this requires a sequence of bytestrings, not Unicode. – Matthias Urlichs Mar 05 '16 at 21:09
  • Further discussed at https://stackoverflow.com/questions/21792231/within-python-what-is-exactly-a-sequence-of-strings-or-else-glib-bug – unndreay Mar 16 '19 at 00:44

2 Answers2

0

Hey I know I'm super late to answer this question but I just ran into the same problem kupfer is such an awesome utility that I couldn't accept having a bug like that in it.

Anyway, change the call to glib.spawn_async (kupfer/utils.py:125-126) from this:
glib.spawn_async(argv, standard_output=True, standard_input=True, standard_error=True, flags=flags, envp=env)
to simply this:
glib.spawn_async(argv)

That worked for me and hopefully others too :)

P.S. If anyone is still using kupfer and is coming to this answer, I just forked the repo and want to try to revive/maintain it so feel free to pitch in if you're interested kupfer2

logileifs
  • 65
  • 1
  • 8
0

As you can see from the glib doc, the error message does not address argv which is the first argument, but the second, envp. The bug was also raised on launchpad and a fix has been provided by KarolBedkowski.

unndreay
  • 353
  • 3
  • 7