karthikeyansam / googlecl

Automatically exported from code.google.com/p/googlecl
0 stars 0 forks source link

google.py not easily called inside Python scripts #355

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What service (Calendar, Docs, Picasa) should be enhanced?
Docs

What is the enhancement?
I would like to be able to pass arguments to the editor declared by --editor in 
addition to the temporary file googlecl downloads

Original issue reported on code.google.com by bobp...@gmail.com on 31 Jan 2011 at 11:03

GoogleCodeExporter commented 9 years ago
I believe this is possible in 0.9.12 if you enclose the argument to --editor in 
single quotes.  The same should hold true for saving an editor file the 
configuration file, though I don't think the quotes are necessary for the file.

Can you try the above? It should look like the following

$ google docs edit --editor 'EDITOR -a -b' 

Original comment by tom.h.mi...@gmail.com on 1 Feb 2011 at 2:41

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
You're right, it does. I'm calling "google docs edit -n Foo --format=csv 
--editor='myscript.py --arg'" from within python and it is not working. 
(commandargs in docs/base.py turns into ['myscript.py --arg', 
u'/tmp/tmpfoobar/Foo.csv']) 

... But if I type the command directly into the shell, commandargs expands into 
['myscript.py', '--arg', u'/tmp/tmpfoobar/Foo.csv'] and everything works fine. 
So it looks like something on my end. Thanks!

Original comment by bobp...@gmail.com on 1 Feb 2011 at 5:29

GoogleCodeExporter commented 9 years ago
Ah, so you're calling google.py from within another python script? The 
execution path will change depending on how you're doing that, so you may want 
to take a look at the source. I think this line in particular: 
http://code.google.com/p/googlecl/source/browse/trunk/src/google.py#821

I'm marking this WontFix, since I don't plan on making the main function's 
behavior more script-friendly in the way you were expecting. But if you have 
any suggestions or think this is a bad call, let me know.

Original comment by tom.h.mi...@gmail.com on 14 Feb 2011 at 1:58