3

I was looking for some time, but still can't find any documented way to call python functions from GnomeShell extension code. Is there any possibility to do that?

Kamil
  • 2,712
  • 32
  • 39
  • Simple question since you find your answer : Is there a way to get a number from that python script ? Like the exit status or such ? – Depado Jan 28 '13 at 09:49

2 Answers2

5

You can do it like this :)

const Util = imports.misc.util;
let python_script = '/path/to/python/script';
Util.spawnCommandLine("python " + python_script);
simon
  • 15,344
  • 5
  • 45
  • 67
1

I don't know how to directly call a python function from Gnomeshell, but there is an alternative way. As gnomeshell is programmed with Javascript you could use a python to javascript compiler to translate the python functions you need.

halex
  • 16,253
  • 5
  • 58
  • 67
  • Ok, I think this isn't solution I'm looking for, but it can be useful in some other project. I decided to communicate with Python script using DBus mechanism. – Kamil Aug 27 '12 at 17:10