0

I am using Python on Ubuntu. call(["xdotool", "mousemove", "500","600"])works fine.

But if x=500, y=600,

call(["xdotool", "mousemove", "x","y"]) does not work.

What should be the syntax of x and y?

Sam
  • 79
  • 2
  • 10
  • 2
    Remove the quotes. `"x"` is a string (containing the single letter x). – Tim Peters Oct 30 '13 at 05:17
  • I also tried that but it was not working. – Sam Oct 30 '13 at 05:18
  • @Sam How so? Please provide the code you tried and the traceback (the error) :) – TerryA Oct 30 '13 at 05:19
  • "not working" isn't helpful, alas. Say *exactly* what happened, including the full text of any error message and traceback. And show the exact code you used. – Tim Peters Oct 30 '13 at 05:19
  • `Traceback (most recent call last): File "./checkstate.py", line 53, in call(["xdotool", "mousemove",x,y]) File "/usr/lib/python2.7/subprocess.py", line 493, in call return Popen(*popenargs, **kwargs).wait() File "/usr/lib/python2.7/subprocess.py", line 679, in __init__ errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child raise child_exception TypeError: execv() arg 2 must contain only strings` – Sam Oct 30 '13 at 05:22
  • 5
    Use `str(x)` and `str(y)`. – Sukrit Kalra Oct 30 '13 at 05:25

2 Answers2

2

use it like this

call(["xdotool", "mousemove", str(x), str(y)])

x and y are variables which are pointing to data. But when you say, "x" and "y", you are passing the data itself.

thefourtheye
  • 233,700
  • 52
  • 457
  • 497
0

Remove the quotes. If you keep quotes, it will treat as a string.

call(["xdotool", "mousemove", "500","600"])

vkrams
  • 7,267
  • 17
  • 79
  • 129