[Libreoffice] Mac - Python scripts not visible / executable in Macros manager

Christian Lohmaier lohmaier+libreoffice at googlemail.com
Mon Mar 7 07:02:43 PST 2011


Hi Caolán, *,

On Mon, Mar 7, 2011 at 12:23 PM, Caolán McNamara <caolanm at redhat.com> wrote:
> On Thu, 2011-03-03 at 01:07 +0100, Christian Lohmaier wrote:
>> Yes, I wonder why it fails here :-(
>
> Gagh, that's frustrating. Can you stick a try: except: block around it

Thanks for pushing me into the correct direction with this!

It's a stupid thing really, the
"found g_exportedScripts Tuple([Name('capitalisePython')])"

is key here - it is "Tuple(.....)" whereas default, builtin type tuple
wouldn't print that. (someone more experienced with python probably
would have spot that right away)

So the expr is not a real tuple, and thus the iteration fails because
python 2.3 doesn't do any implicit conversion, the try - except
revealed a TypeError - iteration over non-sequence

So looking again at the compiler-module's documentation:
http://docs.python.org/release/2.3.5/lib/module-compiler.ast.html

The "Tuple" is a Node-type, that in turn contains a nodes attribute,
iterating over those nodes works, so the fix is:

- for item in node.expr:
+ for item in node.expr.nodes:

ciao
Christian


More information about the LibreOffice mailing list